brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.9 KiB · 39f9954 Raw
66 lines · plain
1; RUN: opt %loadNPMPolly -polly-invariant-load-hoisting=true '-passes=polly-custom<optree>' -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines2;3; Move %val to %bodyB, so %bodyA can be removed (by -polly-simplify).4; This involves making the load-hoisted %val1 to be made available in %bodyB.5;6; for (int j = 0; j < n; j += 1) {7; bodyA:8;   double val = B[0] + 21.0;9;10; bodyB:11;   A[0] = val;12; }13;14define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {15entry:16  br label %for17 18for:19  %j = phi i32 [0, %entry], [%j.inc, %inc]20  %j.cmp = icmp slt i32 %j, %n21  br i1 %j.cmp, label %bodyA, label %exit22 23    bodyA:24      %val1 = load double, ptr %B25      %val2 = fadd double %val1, 21.026      br label %bodyB27 28    bodyB:29      store double %val2, ptr %A30      br label %inc31 32inc:33  %j.inc = add nuw nsw i32 %j, 134  br label %for35 36exit:37  br label %return38 39return:40  ret void41}42 43 44; CHECK: Statistics {45; CHECK:     Instructions copied: 146; CHECK:     Operand trees forwarded: 147; CHECK:     Statements with forwarded operand trees: 148; CHECK: }49 50; CHECK:      After statements {51; CHECK-NEXT:     Stmt_bodyA52; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 1]53; CHECK-NEXT:                 [n] -> { Stmt_bodyA[i0] -> MemRef_val2[] };54; CHECK-NEXT:             Instructions {55; CHECK-NEXT:                   %val1 = load double, ptr %B, align 856; CHECK-NEXT:                   %val2 = fadd double %val1, 2.100000e+0157; CHECK-NEXT:                 }58; CHECK-NEXT:     Stmt_bodyB59; CHECK-NEXT:             MustWriteAccess :=  [Reduction Type: NONE] [Scalar: 0]60; CHECK-NEXT:                 [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };61; CHECK-NEXT:             Instructions {62; CHECK-NEXT:                   %val2 = fadd double %val1, 2.100000e+0163; CHECK-NEXT:                   store double %val2, ptr %A, align 864; CHECK-NEXT:                 }65; CHECK-NEXT: }66