1 ; RUN: opt %loadPolly -polly-invariant-load-hoisting=true -polly-print-scops -disable-output < %s | FileCheck %s
3 ; void foo(float *A, long *p) {
4 ; for (long i = 0; i < 100; i++)
5 ; for (long j = 0; j < 100; j++)
6 ; A[i * (*p) + j] += i + j;
9 ; CHECK: Invariant Accesses: {
10 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
11 ; CHECK-NEXT: [pval] -> { Stmt_bb5[i0, i1] -> MemRef_p[0] };
12 ; CHECK-NEXT: Execution Context: [pval] -> { : }
15 ; CHECK: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
16 ; CHECK: [pval] -> { Stmt_bb5[i0, i1] -> MemRef_A[i0, i1] };
17 ; CHECK: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
18 ; CHECK: [pval] -> { Stmt_bb5[i0, i1] -> MemRef_A[i0, i1] };
20 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
22 define void @foo(ptr %A, ptr %p) {
26 bb2: ; preds = %bb16, %bb
27 %i.0 = phi i64 [ 0, %bb ], [ %tmp17, %bb16 ]
28 %exitcond1 = icmp ne i64 %i.0, 100
29 br i1 %exitcond1, label %bb3, label %bb18
34 bb4: ; preds = %bb13, %bb3
35 %j.0 = phi i64 [ 0, %bb3 ], [ %tmp14, %bb13 ]
36 %exitcond = icmp ne i64 %j.0, 100
37 br i1 %exitcond, label %bb5, label %bb15
40 %tmp = add nuw nsw i64 %i.0, %j.0
41 %tmp6 = sitofp i64 %tmp to float
42 %pval = load i64, ptr %p, align 8
43 %tmp8 = mul nsw i64 %i.0, %pval
44 %tmp9 = add nsw i64 %tmp8, %j.0
45 %tmp10 = getelementptr inbounds float, ptr %A, i64 %tmp9
46 %tmp11 = load float, ptr %tmp10, align 4
47 %tmp12 = fadd float %tmp11, %tmp6
48 store float %tmp12, ptr %tmp10, align 4
52 %tmp14 = add nuw nsw i64 %j.0, 1
59 %tmp17 = add nuw nsw i64 %i.0, 1