1; RUN: opt %loadPolly -polly-optree -analyze < %s | FileCheck %s -match-full-lines 2; 3; Rematerialize a load. 4; 5; for (int j = 0; j < n; j += 1) { 6; bodyA: 7; double val = B[j]; 8; 9; bodyB: 10; A[j] = val; 11; } 12; 13 14declare double @f() #0 15 16define void @func(i32 %n, double* noalias nonnull %A, double* noalias nonnull %B) { 17entry: 18 br label %for 19 20for: 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 24 25 bodyA: 26 %val = call double @f() 27 %A_idx = getelementptr inbounds double, double* %A, i32 %j 28 store double %val, double* %A_idx 29 br label %bodyB 30 31 bodyB: 32 %B_idx = getelementptr inbounds double, double* %B, i32 %j 33 store double %val, double* %B_idx 34 br label %inc 35 36inc: 37 %j.inc = add nuw nsw i32 %j, 1 38 br label %for 39 40exit: 41 br label %return 42 43return: 44 ret void 45} 46 47attributes #0 = { nounwind readnone } 48 49 50; CHECK: Statistics { 51; CHECK: Reloads: 1 52; CHECK: } 53 54; CHECK: After statements { 55; CHECK-NEXT: Stmt_bodyA 56; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 57; CHECK-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_A[i0] }; 58; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1] 59; CHECK-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_val[] }; 60; CHECK-NEXT: Instructions { 61; CHECK-NEXT: %val = call double @f() 62; CHECK-NEXT: store double %val, double* %A_idx, align 8 63; CHECK-NEXT: } 64; CHECK-NEXT: Stmt_bodyB 65; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0] 66; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_B[i0] }; 67; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 1] 68; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_val[] }; 69; CHECK-NEXT: new: [n] -> { Stmt_bodyB[i0] -> MemRef_A[i0] }; 70; CHECK-NEXT: Instructions { 71; CHECK-NEXT: store double %val, double* %B_idx, align 8 72; CHECK-NEXT: } 73; CHECK-NEXT: } 74