1; RUN: opt %loadPolly -polly-scops -analyze \
2; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
3;
4;    void f(unsigned long *restrict I, unsigned *restrict A, unsigned N) {
5;      for (unsigned i = 0; i < N; i++) {
6;        unsigned V = *I;
7;        if (V < i)
8;          A[i]++;
9;      }
10;    }
11;
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) }
16;
17; CHECK:         Domain :=
18; CHECK-NEXT:    [N, tmp] -> { Stmt_if_then[i0] : tmp >= 0 and tmp < i0 < N };
19;
20target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
21
22define void @f(i64* noalias %I, i32* noalias %A, i32 %N, i32 %M) {
23entry:
24  br label %for.cond
25
26for.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
31
32for.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
38
39if.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
44  br label %if.end
45
46if.end:                                           ; preds = %if.then, %for.body
47  br label %for.inc
48
49for.inc:                                          ; preds = %if.end
50  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
51  br label %for.cond
52
53for.end:                                          ; preds = %for.cond
54  ret void
55}
56