40 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<import-jscop;codegen>' -polly-invariant-load-hoisting -S 2>&1 < %s | FileCheck %s2 3; Setting new access functions where the base pointer of the array that is newly4; accessed is only loaded within the scop itself caused incorrect code to be5; generated when invariant load hoisting is disabled. This test case checks6; that in case invariant load hoisting is enabled, we generate correct code.7 8; CHECK: %polly.access.polly.access.X.load = getelementptr float, ptr %polly.access.X.load, i64 %polly.indvar9 10define void @invariant_base_ptr(ptr noalias %Array, ptr noalias %X,11 ptr noalias %C) {12 13start:14 br label %loop15 16loop:17 %indvar = phi i64 [0, %start], [%indvar.next, %latch]18 %indvar.next = add i64 %indvar, 119 %cmp = icmp slt i64 %indvar, 102420 br i1 %cmp, label %body, label %exit21 22body:23 %gep= getelementptr float, ptr %Array, i64 %indvar24 store float 42.0, ptr %gep25 br label %body226 27body2:28 %Base = load ptr, ptr %X29 %gep2 = getelementptr float, ptr %Base, i64 %indvar30 %val2 = load float, ptr %gep231 store float %val2, ptr %C32 br label %latch33 34latch:35 br label %loop36 37exit:38 ret void39}40