1; RUN: opt %loadPolly -polly-scops -polly-invariant-load-hoisting=true -polly-ignore-aliasing -analyze < %s | FileCheck %s
2;
3; CHECK: Invariant Accesses:
4; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
5; CHECK-NEXT:   [N] -> { Stmt_bb5[i0] -> MemRef_BP[0] };
6; CHECK-NEXT:  Execution Context: [N] -> {  : N >= 514 }
7;
8;    void f(int *BP, int *A, int N) {
9;      for (int i = 0; i < N; i++)
10;        if (i > 512)
11;          A[i] = *BP;
12;        else
13;          A[i] = 0;
14;    }
15;
16target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
17
18define void @f(i32* %BP, i32* %A, i32 %N) {
19bb:
20  %tmp = sext i32 %N to i64
21  br label %bb1
22
23bb1:                                              ; preds = %bb11, %bb
24  %indvars.iv = phi i64 [ %indvars.iv.next, %bb11 ], [ 0, %bb ]
25  %tmp2 = icmp slt i64 %indvars.iv, %tmp
26  br i1 %tmp2, label %bb3, label %bb12
27
28bb3:                                              ; preds = %bb1
29  %tmp4 = icmp sgt i64 %indvars.iv, 512
30  br i1 %tmp4, label %bb5, label %bb8
31
32bb5:                                              ; preds = %bb3
33  %tmp9a = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
34  %inv = load i32, i32 *%BP
35  store i32 %inv, i32* %tmp9a, align 4
36  br label %bb10
37
38bb8:                                              ; preds = %bb3
39  %tmp9b = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
40  store i32 0, i32* %tmp9b, align 4
41  br label %bb10
42
43bb10:                                             ; preds = %bb8, %bb5
44  br label %bb11
45
46bb11:                                             ; preds = %bb10
47  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
48  br label %bb1
49
50bb12:                                             ; preds = %bb1
51  ret void
52}
53