1 ; RUN: opt %loadPolly -polly-print-scops -polly-invariant-load-hoisting=true -disable-output < %s | FileCheck %s
3 ; Check that we do not try to preload *I and assume p != 42.
5 ; CHECK: Invariant Accesses: {
8 ; CHECK: Invalid Context:
9 ; CHECK-NEXT: [N, p] -> { : false }
11 ; CHECK: Stmt_if_then__TO__if_end
12 ; CHECK-NEXT: Domain :=
13 ; CHECK-NEXT: [N, p] -> { Stmt_if_then__TO__if_end[i0] : p = 42 and 0 <= i0 < N };
15 ; void f(int *A, int *I, int N, int p, int q) {
16 ; for (int i = 0; i < N; i++) {
26 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
28 define void @f(ptr %A, ptr %I, i32 %N, i32 %p, i32 %q) {
30 %tmp = sext i32 %N to i64
33 for.cond: ; preds = %for.inc, %entry
34 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
35 %cmp = icmp slt i64 %indvars.iv, %tmp
36 br i1 %cmp, label %for.body, label %for.end
38 for.body: ; preds = %for.cond
39 %cmp1 = icmp eq i32 %p, 42
40 br i1 %cmp1, label %if.then, label %if.end4
42 if.then: ; preds = %for.body
43 store i32 0, ptr %I, align 4
44 %tmp1 = load i32, ptr %I, align 4
45 %cmp2 = icmp eq i32 %tmp1, %q
46 br i1 %cmp2, label %if.then3, label %if.end
48 if.then3: ; preds = %if.then
49 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
50 %tmp2 = load i32, ptr %arrayidx, align 4
51 %mul = shl nsw i32 %tmp2, 1
52 store i32 %mul, ptr %arrayidx, align 4
55 if.end: ; preds = %if.then3, %if.then
58 if.end4: ; preds = %if.end, %for.body
59 %arrayidx6 = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
60 %tmp3 = load i32, ptr %arrayidx6, align 4
61 %inc = add nsw i32 %tmp3, 1
62 store i32 %inc, ptr %arrayidx6, align 4
65 for.inc: ; preds = %if.end4
66 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
69 for.end: ; preds = %for.cond