1; RUN: opt %loadPolly -polly-scops -analyze \ 2; RUN: -polly-invariant-load-hoisting=true < %s | FileCheck %s 3; 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) } 14; CHECK-NEXT: } 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 } 21; 22; CHECK: Statements { 23; CHECK-NEXT: Stmt_S 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] }; 30; CHECK-NEXT: } 31; 32target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 33 34define void @f(i32 %N, i32* noalias %valid, i32* noalias %ptr, i32* noalias %A) { 35entry: 36 %ptr.addr = alloca i32*, align 8 37 store i32* %ptr, i32** %ptr.addr, align 8 38 %tmp = sext i32 %N to i64 39 br label %for.cond 40 41for.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 45 46for.body: ; preds = %for.cond 47 %valid_val = load i32, i32* %valid, align 4 48 %cmp1 = icmp eq i32 %valid_val, 0 49 br i1 %cmp1, label %if.then, label %if.end 50 51if.then: ; preds = %for.body 52 call void @doSth(i32** nonnull %ptr.addr) 53 br label %if.end 54 55if.end: ; preds = %if.then, %for.body 56 br label %S 57 58S: ; preds = %if.end 59 %tmp2 = load i32*, i32** %ptr.addr, align 8 60 %tmp3 = load i32, i32* %tmp2, align 4 61 %arrayidx = getelementptr inbounds i32, i32* %A, i64 %indvars.iv 62 store i32 %tmp3, i32* %arrayidx, align 4 63 br label %for.inc 64 65for.inc: ; preds = %S 66 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1 67 br label %for.cond 68 69for.end: ; preds = %for.cond 70 ret void 71} 72 73declare void @doSth(i32**) 74