1 ; RUN: opt -S -passes=loop-simplify,loop-fusion -debug-only=loop-fusion < %s 2>&1 | FileCheck %s
3 ; CHECK: Could not hoist/sink all instructions
5 @A = common global [100 x i32] zeroinitializer, align 16
6 define void @sink_preheader(i32 %N) {
8 ; CHECK-NEXT: %ptr = alloca i32, align 4
9 ; CHECK-NEXT: br label %body1
11 %ptr = alloca i32, align 4
15 ; CHECK-NOT: store i32 3, ptr %ptr
16 body1: ; preds = %pre1, %body1
17 %i = phi i32 [%i_next, %body1], [0, %pre1]
18 %i_next = add i32 1, %i
19 %cond = icmp ne i32 %i, %N
20 %load1 = load i32, ptr %ptr
21 br i1 %cond, label %body1, label %pre2
24 ; CHECK-NEXT: store i32 3, ptr %ptr
30 ; CHECK-NOT: store i32 3, ptr %ptr
31 body2: ; preds = %pre2, %body2
32 %i2 = phi i32 [%i_next2, %body2], [0, %pre2]
33 %i_next2 = add i32 1, %i2
34 %cond2 = icmp ne i32 %i2, %N
35 %load2 = load i32, ptr %ptr
36 br i1 %cond2, label %body2, label %exit
39 ; CHECK-NOT: store i32 3, ptr %ptr