1 ; RUN: opt %loadPolly -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines
3 ; Rematerialize a load in the presence of a non-store WRITE access.
5 ; for (int j = 0; j < n; j += 1) {
18 declare void @llvm.memset.p0.i64(ptr nocapture, i8, i64, i32, i1)
20 define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
25 %j = phi i32 [0, %entry], [%j.inc, %inc]
26 %j.cmp = icmp slt i32 %j, %n
27 br i1 %j.cmp, label %bodyA, label %exit
30 call void @llvm.memset.p0.i64(ptr %A, i8 0, i64 16, i32 1, i1 false)
31 call void @llvm.memset.p0.i64(ptr %B, i8 0, i64 16, i32 1, i1 false)
35 %B_idx = getelementptr inbounds double, ptr %B, i32 %j
36 %val = load double, ptr %B_idx
40 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
41 store double %val, ptr %A_idx
45 %j.inc = add nuw nsw i32 %j, 1
57 ; CHECK: Known loads forwarded: 1
58 ; CHECK: Operand trees forwarded: 1
59 ; CHECK: Statements with forwarded operand trees: 1
62 ; CHECK-NEXT: After statements {
64 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
65 ; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_B[o0] : 8i0 <= o0 <= 7 + 8i0 };
66 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
67 ; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_val[] };
68 ; CHECK-NEXT: Instructions {
69 ; CHECK-NEXT: %val = load double, ptr %B_idx, align 8
71 ; CHECK-NEXT: Stmt_bodyC
72 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
74 ; CHECK-NEXT: new: [n] -> { Stmt_bodyC[i0] -> MemRef_B[8i0] };
75 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
76 ; CHECK-NEXT: [n] -> { Stmt_bodyC[i0] -> MemRef_A[o0] : 8i0 <= o0 <= 7 + 8i0 };
77 ; CHECK-NEXT: Instructions {
78 ; CHECK-NEXT: %val = load double, ptr %B_idx, align 8
79 ; CHECK-NEXT: store double %val, ptr %A_idx, align 8