1; RUN: opt %loadPolly -polly-import-jscop \ 2; RUN: -polly-codegen -polly-invariant-load-hoisting -S \ 3; RUN: 2>&1 < %s | FileCheck %s 4 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. 9 10; CHECK: %polly.access.polly.access.X.load = getelementptr float, float* %polly.access.X.load, i64 %polly.indvar 11 12define void @invariant_base_ptr(float* noalias %Array, float** noalias %X, 13 float* noalias %C) { 14 15start: 16 br label %loop 17 18loop: 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 23 24body: 25 %gep= getelementptr float, float* %Array, i64 %indvar 26 store float 42.0, float* %gep 27 br label %body2 28 29body2: 30 %Base = load float*, float** %X 31 %gep2 = getelementptr float, float* %Base, i64 %indvar 32 %val2 = load float, float* %gep2 33 store float %val2, float* %C 34 br label %latch 35 36latch: 37 br label %loop 38 39exit: 40 ret void 41} 42