1; RUN: opt %loadPolly -polly-scops -polly-invariant-load-hoisting=true -polly-ignore-aliasing -polly-process-unprofitable -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_BPLoc[0] };
6;
7;    void f(int **BPLoc, int *A, int N) {
8;      for (int i = 0; i < N; i++)
9;        if (i > 512)
10;          (*BPLoc)[i] = 0;
11;        else
12;          A[i] = 0;
13;    }
14;
15target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
16
17define void @f(i32** %BPLoc, i32* %A, i32 %N) {
18bb:
19  %tmp = sext i32 %N to i64
20  br label %bb1
21
22bb1:                                              ; preds = %bb11, %bb
23  %indvars.iv = phi i64 [ %indvars.iv.next, %bb11 ], [ 0, %bb ]
24  %tmp2 = icmp slt i64 %indvars.iv, %tmp
25  br i1 %tmp2, label %bb3, label %bb12
26
27bb3:                                              ; preds = %bb1
28  %tmp4 = icmp sgt i64 %indvars.iv, 512
29  br i1 %tmp4, label %bb5, label %bb8
30
31bb5:                                              ; preds = %bb3
32  %tmp6 = load i32*, i32** %BPLoc, align 8
33  %tmp7 = getelementptr inbounds i32, i32* %tmp6, i64 %indvars.iv
34  store i32 0, i32* %tmp7, align 4
35  br label %bb10
36
37bb8:                                              ; preds = %bb3
38  %tmp9 = getelementptr inbounds i32, i32* %A, i64 %indvars.iv
39  store i32 0, i32* %tmp9, align 4
40  br label %bb10
41
42bb10:                                             ; preds = %bb8, %bb5
43  br label %bb11
44
45bb11:                                             ; preds = %bb10
46  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
47  br label %bb1
48
49bb12:                                             ; preds = %bb1
50  ret void
51}
52