brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · e32b857 Raw
46 lines · plain
1; RUN: opt < %s -passes='function(instcombine),function(mem2reg)' -S | grep "%A = alloca" 2; RUN: opt < %s -passes='function(instcombine),function(mem2reg)' -S | \3; RUN:    not grep "%B = alloca"4; END.5 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.8 9define i32 @test2(i32 %C) {10entry:11	%A = alloca i3212	%B = alloca i3213	%tmp = call i32 (...) @bar( ptr %A )		; <i32> [#uses=0]14	%T = load i32, ptr %A		; <i32> [#uses=1]15	%tmp2 = icmp eq i32 %C, 0		; <i1> [#uses=1]16	br i1 %tmp2, label %cond_next, label %cond_true17 18cond_true:		; preds = %entry19	store i32 123, ptr %B20	call i32 @test2( i32 123 )		; <i32>:0 [#uses=0]21	%T1 = load i32, ptr %B		; <i32> [#uses=1]22	br label %cond_next23 24cond_next:		; preds = %cond_true, %entry25	%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]40	ret i32 %tmp1.041}42 43declare i32 @bar(...)44 45declare i32 @baq(...)46