1 ; RUN: opt %loadNPMPolly '-passes=polly-import-jscop,polly-codegen' \
2 ; RUN: -polly-invariant-load-hoisting -S \
3 ; RUN: 2>&1 < %s | FileCheck %s
5 ; Setting new access functions where the base pointer of the array that is newly
6 ; accessed is only loaded within the scop itself caused incorrect code to be
7 ; generated when invariant load hoisting is disabled. This test case checks
8 ; that in case invariant load hoisting is enabled, we generate correct code.
10 ; CHECK: %polly.access.polly.access.X.load = getelementptr float, ptr %polly.access.X.load, i64 %polly.indvar
12 define void @invariant_base_ptr(ptr noalias %Array, ptr noalias %X,
19 %indvar = phi i64 [0, %start], [%indvar.next, %latch]
20 %indvar.next = add i64 %indvar, 1
21 %cmp = icmp slt i64 %indvar, 1024
22 br i1 %cmp, label %body, label %exit
25 %gep= getelementptr float, ptr %Array, i64 %indvar
26 store float 42.0, ptr %gep
30 %Base = load ptr, ptr %X
31 %gep2 = getelementptr float, ptr %Base, i64 %indvar
32 %val2 = load float, ptr %gep2
33 store float %val2, ptr %C