1 ; RUN: opt %loadPolly -polly-stmt-granularity=bb -polly-print-optree -disable-output < %s | FileCheck %s -match-full-lines
3 ; Rematerialize a load even in case two writes of identical values are in
6 define void @func(i32 %n, ptr noalias nonnull %A, ptr noalias nonnull %B) {
11 %j = phi i32 [0, %entry], [%j.inc, %inc]
12 %j.cmp = icmp slt i32 %j, %n
13 br i1 %j.cmp, label %bodyA, label %exit
16 %B_idx = getelementptr inbounds double, ptr %B, i32 %j
17 %val = load double, ptr %B_idx
21 %A_idx = getelementptr inbounds double, ptr %A, i32 %j
22 store double %val, ptr %A_idx
23 store double %val, ptr %A_idx
27 %j.inc = add nuw nsw i32 %j, 1
39 ; CHECK: Known loads forwarded: 1
40 ; CHECK: Operand trees forwarded: 1
41 ; CHECK: Statements with forwarded operand trees: 1
45 ; CHECK-NEXT: ReadAccess := [Reduction Type: NONE] [Scalar: 0]
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 8
54 ; CHECK-NEXT: store double %val, ptr %A_idx, align 8
55 ; CHECK-NEXT: store double %val, ptr %A_idx, align 8