57 lines · plain
1; RUN: opt %loadNPMPolly -polly-stmt-granularity=bb '-passes=polly-custom<optree>' -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines2;3; Rematerialize a load even in case two writes of identical values are in4; one scop statement.5;6define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {7entry:8 br label %for9 10for:11 %j = phi i32 [0, %entry], [%j.inc, %inc]12 %j.cmp = icmp slt i32 %j, %n13 br i1 %j.cmp, label %bodyA, label %exit14 15 bodyA:16 %B_idx = getelementptr inbounds double, ptr %B, i32 %j17 %val = load double, ptr %B_idx18 br label %bodyB19 20 bodyB:21 %A_idx = getelementptr inbounds double, ptr %A, i32 %j22 store double %val, ptr %A_idx23 store double %val, ptr %A_idx24 br label %inc25 26inc:27 %j.inc = add nuw nsw i32 %j, 128 br label %for29 30exit:31 br label %return32 33return:34 ret void35}36 37 38; CHECK: Statistics {39; CHECK: Known loads forwarded: 140; CHECK: Operand trees forwarded: 141; CHECK: Statements with forwarded operand trees: 142; CHECK: }43 44; CHECK: Stmt_bodyB45; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]46; CHECK-NEXT: ;47; CHECK-NEXT: new: [n] -> { Stmt_bodyB[i0] -> MemRef_B[i0] };48; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]49; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[i0] };50; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]51; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[i0] };52; CHECK-NEXT: Instructions {53; CHECK-NEXT: %val = load double, ptr %B_idx, align 854; CHECK-NEXT: store double %val, ptr %A_idx, align 855; CHECK-NEXT: store double %val, ptr %A_idx, align 856; CHECK-NEXT: }57