1 ; RUN: opt %loadNPMPolly -polly-optree-normalize-phi=true '-passes=print<polly-optree>' -disable-output < %s | FileCheck %s -match-full-lines
3 ; Rematerialize a load.
5 ; for (int j = 0; j < n; j += 1) {
16 define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
21 %j = phi i32 [0, %entry], [%j.inc, %inc]
22 %j.cmp = icmp slt i32 %j, %n
23 br i1 %j.cmp, label %bodyA, label %exit
26 %B_idx = getelementptr inbounds double, ptr %B, i32 %j
27 %val = load double, ptr %B_idx
31 %phi = phi double [%val, %bodyA]
35 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
36 store double %phi, ptr %A_idx
40 %j.inc = add nuw nsw i32 %j, 1
55 ; CHECK-NEXT: After statements {
56 ; CHECK-NEXT: Stmt_bodyA
57 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
58 ; CHECK-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_B[i0] };
59 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
60 ; CHECK-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_phi__phi[] };
61 ; CHECK-NEXT: Instructions {
62 ; CHECK-NEXT: %val = load double, ptr %B_idx, align 8
64 ; CHECK-NEXT: Stmt_bodyB
65 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
66 ; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_phi__phi[] };
67 ; CHECK-NEXT: new: [n] -> { Stmt_bodyB[i0] -> MemRef_B[i0] };
68 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
69 ; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_phi[] };
70 ; CHECK-NEXT: Instructions {
71 ; CHECK-NEXT: %phi = phi double [ %val, %bodyA ]
73 ; CHECK-NEXT: Stmt_bodyC
74 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
75 ; CHECK-NEXT: [n] -> { Stmt_bodyC[i0] -> MemRef_A[i0] };
76 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1]
77 ; CHECK-NEXT: [n] -> { Stmt_bodyC[i0] -> MemRef_phi[] };
78 ; CHECK-NEXT: new: [n] -> { Stmt_bodyC[i0] -> MemRef_B[i0] };
79 ; CHECK-NEXT: Instructions {
80 ; CHECK-NEXT: store double %phi, ptr %A_idx, align 8