1; RUN: opt %loadPolly -basic-aa -loop-rotate -indvars       -polly-prepare \
2; RUN: -polly-invariant-load-hoisting=true -polly-scops -analyze < %s \
3; RUN: | FileCheck %s
4; RUN: opt %loadPolly -basic-aa -loop-rotate -indvars -licm -polly-prepare \
5; RUN: -polly-invariant-load-hoisting=true -polly-scops -analyze < %s \
6; RUN: | FileCheck %s
7;
8;    void foo(int n, float A[static const restrict n],
9;             float B[static const restrict n], int j) {
10;      for (int i = 0; i < n; i++)
11;        A[i] = B[j];
12;    }
13;
14target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
15
16define void @foo(i32 %n, float* noalias nonnull %A, float* noalias nonnull %B, i32 %j) {
17entry:
18  %tmp = sext i32 %n to i64
19  br label %for.cond
20
21for.cond:                                         ; preds = %for.inc, %entry
22  %indvars.iv = phi i64 [ %indvars.iv.next, %for.inc ], [ 0, %entry ]
23  %cmp = icmp slt i64 %indvars.iv, %tmp
24  br i1 %cmp, label %for.body, label %for.end
25
26for.body:                                         ; preds = %for.cond
27  %idxprom = sext i32 %j to i64
28  %arrayidx = getelementptr inbounds float, float* %B, i64 %idxprom
29  %tmp1 = bitcast float* %arrayidx to i32*
30  %tmp2 = load i32, i32* %tmp1, align 4
31  %arrayidx2 = getelementptr inbounds float, float* %A, i64 %indvars.iv
32  %tmp3 = bitcast float* %arrayidx2 to i32*
33  store i32 %tmp2, i32* %tmp3, align 4
34  br label %for.inc
35
36for.inc:                                          ; preds = %for.body
37  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
38  br label %for.cond
39
40for.end:                                          ; preds = %for.cond
41  ret void
42}
43
44; CHECK:      Invariant Accesses: {
45; CHECK-NEXT:   ReadAccess := [Reduction Type: NONE] [Scalar: 0]
46; CHECK-NEXT:       [n, j] -> { Stmt_{{[a-zA-Z_]*}}[{{[i0]*}}] -> MemRef_B[j] };
47; CHECK-NEXT:       Execution Context: [n, j] -> {  : n > 0 }
48; CHECK-NEXT: }
49;
50; CHECK: Statements {
51; CHECK:      Stmt_for_body
52; CHECK:     MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]
53; CHECK-NEXT:        [n, j] -> { Stmt_for_body[i0] -> MemRef_A[i0] };
54; CHECK:     }
55