1; RUN: opt %loadPolly -polly-scops -polly-invariant-load-hoisting=true -analyze < %s | FileCheck %s 2; 3; Check that we model the execution context correctly. 4; 5; void f(unsigned *I, unsigned *A, int c) { 6; for (unsigned i = c; i < 10; i++) 7; A[i] += *I; 8; } 9; 10; CHECK: Invariant Accesses: { 11; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0] 12; CHECK-NEXT: [c] -> { Stmt_for_body[i0] -> MemRef_I[0] }; 13; CHECK-NEXT: Execution Context: [c] -> { : 0 <= c <= 9 } 14; CHECK-NEXT: } 15; 16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 17 18define void @f(i32* %I, i32* %A, i64 %c) { 19entry: 20 br label %for.cond 21 22for.cond: ; preds = %for.inc, %entry 23 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ %c, %entry ] 24 %exitcond = icmp ult i64 %indvars.iv, 10 25 br i1 %exitcond, label %for.body, label %for.end 26 27for.body: ; preds = %for.cond 28 %tmp = load i32, i32* %I, align 4 29 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 30 %tmp1 = load i32, i32* %arrayidx, align 4 31 %add = add i32 %tmp1, %tmp 32 store i32 %add, i32* %arrayidx, align 4 33 br label %for.inc 34 35for.inc: ; preds = %for.body 36 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 37 br label %for.cond 38 39for.end: ; preds = %for.cond 40 ret void 41} 42