1 ; RUN: opt %loadPolly -polly-scops -polly-invariant-load-hoisting=true -analyze < %s | FileCheck %s
3 ; Check that we model the execution context correctly.
5 ; void f(unsigned *I, unsigned *A, int c) {
6 ; for (unsigned i = c; i < 10; i++)
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 }
16 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
18 define void @f(i32* %I, i32* %A, i64 %c) {
22 for.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
27 for.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
35 for.inc: ; preds = %for.body
36 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
39 for.end: ; preds = %for.cond