1 ; RUN: opt %loadPolly -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines
3 ; Move operand tree without duplicating values used multiple times.
5 define void @func(i32 %n, ptr noalias nonnull %A) {
10 %j = phi i32 [0, %entry], [%j.inc, %inc]
11 %j.cmp = icmp slt i32 %j, %n
12 br i1 %j.cmp, label %bodyA, label %exit
15 %val1 = fadd double 12.5, 12.5
16 %val2 = fadd double %val1, %val1
17 %val3 = fadd double %val2, %val2
18 %val4 = fadd double %val3, %val3
19 %val5 = fadd double %val4, %val4
23 store double %val5, ptr %A
27 %j.inc = add nuw nsw i32 %j, 1
39 ; CHECK: Instructions copied: 5
40 ; CHECK: Operand trees forwarded: 1
43 ; CHECK: After statements {
44 ; CHECK-NEXT: Stmt_bodyA
45 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 1]
46 ; CHECK-NEXT: [n] -> { Stmt_bodyA[i0] -> MemRef_val5[] };
47 ; CHECK-NEXT: Instructions {
48 ; CHECK-NEXT: %val1 = fadd double 1.250000e+01, 1.250000e+01
49 ; CHECK-NEXT: %val2 = fadd double %val1, %val1
50 ; CHECK-NEXT: %val3 = fadd double %val2, %val2
51 ; CHECK-NEXT: %val4 = fadd double %val3, %val3
52 ; CHECK-NEXT: %val5 = fadd double %val4, %val4
54 ; CHECK-NEXT: Stmt_bodyB
55 ; CHECK-NEXT: MustWriteAccess := [Reduction Type: NONE] [Scalar: 0]
56 ; CHECK-NEXT: [n] -> { Stmt_bodyB[i0] -> MemRef_A[0] };
57 ; CHECK-NEXT: Instructions {
58 ; CHECK-NEXT: %val1 = fadd double 1.250000e+01, 1.250000e+01
59 ; CHECK-NEXT: %val2 = fadd double %val1, %val1
60 ; CHECK-NEXT: %val3 = fadd double %val2, %val2
61 ; CHECK-NEXT: %val4 = fadd double %val3, %val3
62 ; CHECK-NEXT: %val5 = fadd double %val4, %val4
63 ; CHECK-NEXT: store double %val5, ptr %A, align 8