1 ; RUN: opt %loadPolly -S -polly-codegen-ppcg \
2 ; RUN: -polly-invariant-load-hoisting < %s | FileCheck %s
6 ; CHECK: store i64 %polly.access.B.load, i64* %invariant.preload.s2a
7 ; CHECK: %invariant.final_reload = load i64, i64* %invariant.preload.s2a
9 ; Verify that the final reload of an invariant scalar memory access uses the
10 ; same stack slot that into which the invariant memory access was stored
11 ; originally. Earlier, this was broken as we introduce a new stack slot aside
12 ; of the preload stack slot, which remained uninitialized and caused our escaping
13 ; loads to contain garbage.
15 define i64 @foo(float* %A, i64* %B) {
20 %indvar = phi i64 [0, %entry], [%indvar.next, %loop]
21 %indvar.next = add nsw i64 %indvar, 1
22 %idx = getelementptr float, float* %A, i64 %indvar
23 store float 42.0, float* %idx
24 %invariant = load i64, i64* %B
25 %cmp = icmp sle i64 %indvar, 1024
26 br i1 %cmp, label %loop, label %exit