1; RUN: opt %loadPolly -polly-ignore-aliasing -polly-invariant-load-hoisting=true -polly-scops -polly-import-jscop -polly-codegen -analyze < %s | FileCheck %s 2; 3; This violated an assertion in setNewAccessRelation that assumed base pointers 4; to be load-hoisted. Without this assertion, it codegen would generate invalid 5; code. 6; 7target 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" 8 9define void @base_pointer_load_is_inst_inside_invariant_1(i64 %n, float** %A) { 10entry: 11 br label %for.i 12 13for.i: 14 %indvar.i = phi i64 [ %indvar.i.next, %for.i.inc ], [ 0, %entry ] 15 br label %S1 16 17S1: 18 %ptr = load float*, float** %A 19 %conv = sitofp i64 %indvar.i to float 20 %arrayidx5 = getelementptr float, float* %ptr, i64 %indvar.i 21 store float %conv, float* %arrayidx5, align 4 22 br label %for.i.inc 23 24for.i.inc: 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 28 29exit: 30 ret void 31} 32 33 34; Detected by -polly-detect with required load hoist. 35; CHECK-NOT: Valid Region for Scop: for.i => exit 36; 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 } 42; CHECK-NEXT: } 43