1 ; RUN: opt %loadPolly -polly-print-scops -disable-output \
2 ; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s
4 ; CHECK: Invariant Accesses: {
5 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
6 ; CHECK-NEXT: [N, valid_val] -> { Stmt_for_body[i0] -> MemRef_valid[0] };
7 ; CHECK-NEXT: Execution Context: [N, valid_val] -> { : N > 0 }
8 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
9 ; CHECK-NEXT: [N, valid_val] -> { Stmt_S[i0] -> MemRef_ptr_addr[0] };
10 ; CHECK-NEXT: Execution Context: [N, valid_val] -> { : }
11 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
12 ; CHECK-NEXT: [N, valid_val] -> { Stmt_S[i0] -> MemRef_tmp2[0] };
13 ; CHECK-NEXT: Execution Context: [N, valid_val] -> { : N > 0 and (valid_val < 0 or valid_val > 0) }
15 ; CHECK-NEXT: Context:
16 ; CHECK-NEXT: [N, valid_val] -> { : -2147483648 <= N <= 2147483647 and -2147483648 <= valid_val <= 2147483647 }
17 ; CHECK-NEXT: Assumed Context:
18 ; CHECK-NEXT: [N, valid_val] -> { : }
19 ; CHECK-NEXT: Invalid Context:
20 ; CHECK-NEXT: [N, valid_val] -> { : valid_val = 0 and N > 0 }
24 ; CHECK-NEXT: Domain :=
25 ; CHECK-NEXT: [N, valid_val] -> { Stmt_S[i0] : 0 <= i0 < N };
26 ; CHECK-NEXT: Schedule :=
27 ; CHECK-NEXT: [N, valid_val] -> { Stmt_S[i0] -> [i0] };
28 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
29 ; CHECK-NEXT: [N, valid_val] -> { Stmt_S[i0] -> MemRef_A[i0] };
32 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
34 define void @f(i32 %N, ptr noalias %valid, ptr noalias %ptr, ptr noalias %A) {
36 %ptr.addr = alloca ptr, align 8
37 store ptr %ptr, ptr %ptr.addr, align 8
38 %tmp = sext i32 %N to i64
41 for.cond: ; preds = %for.inc, %entry
42 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
43 %cmp = icmp slt i64 %indvars.iv, %tmp
44 br i1 %cmp, label %for.body, label %for.end
46 for.body: ; preds = %for.cond
47 %valid_val = load i32, ptr %valid, align 4
48 %cmp1 = icmp eq i32 %valid_val, 0
49 br i1 %cmp1, label %if.then, label %if.end
51 if.then: ; preds = %for.body
52 call void @doSth(ptr nonnull %ptr.addr)
55 if.end: ; preds = %if.then, %for.body
59 %tmp2 = load ptr, ptr %ptr.addr, align 8
60 %tmp3 = load i32, ptr %tmp2, align 4
61 %arrayidx = getelementptr inbounds i32, ptr %A, i64 %indvars.iv
62 store i32 %tmp3, ptr %arrayidx, align 4
66 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
69 for.end: ; preds = %for.cond
73 declare void @doSth(ptr)