1 ; RUN: opt %loadNPMPolly -passes='loop(loop-rotate,indvars),polly-prepare,print<polly-function-scops>' -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 \
3 ; RUN: opt %loadNPMPolly -passes='loop-mssa(loop-rotate,indvars,licm),polly-prepare,print<polly-function-scops>' -polly-invariant-load-hoisting=true -disable-output < %s 2>&1 \
6 ; void foo(int n, float A[static const restrict n],
7 ; float B[static const restrict n], int j) {
8 ; for (int i = 0; i < n; i++)
12 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
14 define void @foo(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B, i32 %j) {
16 %tmp = sext i32 %n to i64
19 for.cond: ; preds = %for.inc, %entry
20 %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
21 %cmp = icmp slt i64 %indvars.iv, %tmp
22 br i1 %cmp, label %for.body, label %for.end
24 for.body: ; preds = %for.cond
25 %idxprom = sext i32 %j to i64
26 %arrayidx = getelementptr inbounds float, ptr %B, i64 %idxprom
27 %tmp2 = load i32, ptr %arrayidx, align 4
28 %arrayidx2 = getelementptr inbounds float, ptr %A, i64 %indvars.iv
29 store i32 %tmp2, ptr %arrayidx2, align 4
32 for.inc: ; preds = %for.body
33 %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
36 for.end: ; preds = %for.cond
40 ; CHECK: Invariant Accesses: {
41 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
42 ; CHECK-NEXT: [n, j] -> { Stmt_{{[a-zA-Z_]*}}[{{[i0]*}}] -> MemRef_B[j] };
43 ; CHECK-NEXT: Execution Context: [n, j] -> { : n > 0 }
47 ; CHECK: Stmt_for_body
48 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
49 ; CHECK-NEXT: [n, j] -> { Stmt_for_body[i0] -> MemRef_A[i0] };