65 lines · plain
1; RUN: opt %loadNPMPolly '-passes=polly-custom<optree>' -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines2;3; Rematerialize a load.4; The non-analyzable store to C[0] is unrelated and can be ignored.5;6; for (int j = 0; j < n; j += 1) {7; bodyA:8; double val = B[j];9; C[0] = 21.0;10; C[0] = 42.0;11;12; bodyB:13; A[j] = val;14; }15;16define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B, ptr noalias %C) {17entry:18 br label %for19 20for:21 %j = phi i32 [0, %entry], [%j.inc, %inc]22 %j.cmp = icmp slt i32 %j, %n23 br i1 %j.cmp, label %bodyA, label %exit24 25 bodyA:26 %B_idx = getelementptr inbounds double, ptr %B, i32 %j27 %val = load double, ptr %B_idx28 store double 21.0, ptr %C29 store double 41.0, ptr %C30 br label %bodyB31 32 bodyB:33 %A_idx = getelementptr inbounds double, ptr %A, i32 %j34 store double %val, ptr %A_idx35 br label %inc36 37inc:38 %j.inc = add nuw nsw i32 %j, 139 br label %for40 41exit:42 br label %return43 44return:45 ret void46}47 48 49; CHECK: Statistics {50; CHECK: Known loads forwarded: 151; CHECK: Operand trees forwarded: 152; CHECK: Statements with forwarded operand trees: 153; CHECK: }54 55; CHECK: Stmt_bodyB56; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]57; CHECK-NEXT: ;58; CHECK-NEXT: new: [n] -> { Stmt_bodyB[i0] -> MemRef_B[i0] };59; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]60; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[i0] };61; CHECK-NEXT: Instructions {62; CHECK-NEXT: %val = load double, ptr %B_idx, align 863; CHECK-NEXT: store double %val, ptr %A_idx, align 864; CHECK-NEXT: }65