1 ; RUN: opt %loadNPMPolly -polly-ignore-aliasing -polly-invariant-load-hoisting=true '-passes=print<polly-function-scops>,scop(polly-import-jscop,polly-codegen)' -disable-output < %s 2>&1 | FileCheck %s
3 ; This violated an assertion in setNewAccessRelation that assumed base pointers
4 ; to be load-hoisted. Without this assertion, it codegen would generate invalid
7 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
9 define void @base_pointer_load_is_inst_inside_invariant_1(i64 %n, ptr %A) {
14 %indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ]
18 %ptr = load ptr, ptr %A
19 %conv = sitofp i64 %indvar.i to float
20 %arrayidx5 = getelementptr float, ptr %ptr, i64 %indvar.i
21 store float %conv, ptr %arrayidx5, align 4
25 %indvar.i.next = add i64 %indvar.i, 1
26 %exitcond.i = icmp ne i64 %indvar.i.next, %n
27 br i1 %exitcond.i, label %for.i, label %exit
34 ; Detected by -polly-detect with required load hoist.
35 ; CHECK-NOT: Valid Region for Scop: for.i => exit
37 ; Load hoist if %ptr by -polly-scops.
38 ; CHECK: Invariant Accesses: {
39 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
40 ; CHECK-NEXT: [n] -> { Stmt_S1[i0] -> MemRef_A[0] };
41 ; CHECK-NEXT: Execution Context: [n] -> { : n > 0 }