1 ; RUN: opt %loadPolly -polly-invariant-load-hoisting=true -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines
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.
6 ; for (int j = 0; j < n; j += 1) {
8 ; double val = B[0] + 21.0;
14 define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
19 %j = phi i32 [0, %entry], [%j.inc, %inc]
20 %j.cmp = icmp slt i32 %j, %n
21 br i1 %j.cmp, label %bodyA, label %exit
24 %val1 = load double, ptr %B
25 %val2 = fadd double %val1, 21.0
29 store double %val2, ptr %A
33 %j.inc = add nuw nsw i32 %j, 1
45 ; CHECK: Instructions copied: 1
46 ; CHECK: Operand trees forwarded: 1
47 ; CHECK: Statements with forwarded operand trees: 1
50 ; CHECK: After statements {
51 ; CHECK-NEXT: Stmt_bodyA
52 ; 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 8
56 ; CHECK-NEXT: %val2 = fadd double %val1, 2.100000e+01
58 ; CHECK-NEXT: Stmt_bodyB
59 ; 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+01
63 ; CHECK-NEXT: store double %val2, ptr %A, align 8