1 ; RUN: opt %loadPolly -polly-scops -analyze \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 ; void f(unsigned long *restrict I, unsigned *restrict A, unsigned N) {
5 ; for (unsigned i = 0; i < N; i++) {
12 ; CHECK: Assumed Context:
13 ; CHECK-NEXT: [N, tmp] -> { : }
14 ; CHECK-NEXT: Invalid Context:
15 ; CHECK-NEXT: [N, tmp] -> { : N > 0 and (tmp < 0 or tmp >= 2147483648) }
18 ; CHECK-NEXT: [N, tmp] -> { Stmt_if_then[i0] : tmp >= 0 and tmp < i0 < N };
20 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22 define void @f(i64* noalias %I, i32* noalias %A, i32 %N, i32 %M) {
26 for.cond: ; preds = %for.inc, %entry
27 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
28 %lftr.wideiv = trunc i64 %indvars.iv to i32
29 %exitcond = icmp ne i32 %lftr.wideiv, %N
30 br i1 %exitcond, label %for.body, label %for.end
32 for.body: ; preds = %for.cond
33 %tmp = load i64, i64* %I, align 8
34 %conv = trunc i64 %tmp to i32
35 %tmp1 = zext i32 %conv to i64
36 %cmp1 = icmp ult i64 %tmp1, %indvars.iv
37 br i1 %cmp1, label %if.then, label %if.end
39 if.then: ; preds = %for.body
40 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
41 %tmp2 = load i32, i32* %arrayidx, align 4
42 %inc = add i32 %tmp2, 1
43 store i32 %inc, i32* %arrayidx, align 4
46 if.end: ; preds = %if.then, %for.body
49 for.inc: ; preds = %if.end
50 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
53 for.end: ; preds = %for.cond