1 ; RUN: opt < %s -instcombine -mem2reg -S | grep "%A = alloca"
2 ; RUN: opt < %s -instcombine -mem2reg -S | \
3 ; RUN: not grep "%B = alloca"
6 ; Ensure that instcombine doesn't sink the loads in entry/cond_true into
7 ; cond_next. Doing so prevents mem2reg from promoting the B alloca.
9 define i32 @test2(i32 %C) {
13 %tmp = call i32 (...) @bar( i32* %A ) ; <i32> [#uses=0]
14 %T = load i32, i32* %A ; <i32> [#uses=1]
15 %tmp2 = icmp eq i32 %C, 0 ; <i1> [#uses=1]
16 br i1 %tmp2, label %cond_next, label %cond_true
18 cond_true: ; preds = %entry
19 store i32 123, i32* %B
20 call i32 @test2( i32 123 ) ; <i32>:0 [#uses=0]
21 %T1 = load i32, i32* %B ; <i32> [#uses=1]
24 cond_next: ; preds = %cond_true, %entry
25 %tmp1.0 = phi i32 [ %T1, %cond_true ], [ %T, %entry ] ; <i32> [#uses=1]
26 %tmp7 = call i32 (...) @baq( ) ; <i32> [#uses=0]
27 %tmp8 = call i32 (...) @baq( ) ; <i32> [#uses=0]
28 %tmp9 = call i32 (...) @baq( ) ; <i32> [#uses=0]
29 %tmp10 = call i32 (...) @baq( ) ; <i32> [#uses=0]
30 %tmp11 = call i32 (...) @baq( ) ; <i32> [#uses=0]
31 %tmp12 = call i32 (...) @baq( ) ; <i32> [#uses=0]
32 %tmp13 = call i32 (...) @baq( ) ; <i32> [#uses=0]
33 %tmp14 = call i32 (...) @baq( ) ; <i32> [#uses=0]
34 %tmp15 = call i32 (...) @baq( ) ; <i32> [#uses=0]
35 %tmp16 = call i32 (...) @baq( ) ; <i32> [#uses=0]
36 %tmp17 = call i32 (...) @baq( ) ; <i32> [#uses=0]
37 %tmp18 = call i32 (...) @baq( ) ; <i32> [#uses=0]
38 %tmp19 = call i32 (...) @baq( ) ; <i32> [#uses=0]
39 %tmp20 = call i32 (...) @baq( ) ; <i32> [#uses=0]