Imported Upstream version 6.10.0.49

Former-commit-id: 1d6753294b2993e1fbf92de9366bb9544db4189b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2020-01-16 16:38:04 +00:00
parent d94e79959b
commit 468663ddbb
48518 changed files with 2789335 additions and 61176 deletions

View File

@@ -0,0 +1,18 @@
; RUN: opt < %s -basicaa -licm -disable-output
;%MoveArray = external global [64 x ulong]
define void @InitMoveArray() {
bb3:
%X = alloca [2 x i64] ; <[2 x i64]*> [#uses=1]
br i1 false, label %bb13, label %bb4
bb4: ; preds = %bb3
%reg3011 = getelementptr [2 x i64], [2 x i64]* %X, i64 0, i64 0 ; <i64*> [#uses=1]
br label %bb8
bb8: ; preds = %bb8, %bb4
store i64 0, i64* %reg3011
br i1 false, label %bb8, label %bb13
bb13: ; preds = %bb8, %bb3
ret void
}

View File

@@ -0,0 +1,17 @@
; Exit blocks need to be updated for all nested loops...
; RUN: opt < %s -loop-simplify
define i32 @yyparse() {
bb0:
br i1 false, label %UnifiedExitNode, label %bb19
bb19: ; preds = %bb28, %bb0
br i1 false, label %bb28, label %UnifiedExitNode
bb28: ; preds = %bb32, %bb19
br i1 false, label %bb32, label %bb19
bb32: ; preds = %bb28
br i1 false, label %UnifiedExitNode, label %bb28
UnifiedExitNode: ; preds = %bb32, %bb19, %bb0
ret i32 0
}

View File

@@ -0,0 +1,16 @@
; This testcase fails because preheader insertion is not updating exit node
; information for loops.
; RUN: opt < %s -licm
define i32 @main(i32 %argc, i8** %argv) {
bb0:
br i1 false, label %bb7, label %bb5
bb5: ; preds = %bb5, %bb0
br i1 false, label %bb5, label %bb7
bb7: ; preds = %bb7, %bb5, %bb0
br i1 false, label %bb7, label %bb10
bb10: ; preds = %bb7
ret i32 0
}

View File

@@ -0,0 +1,24 @@
; Here we have a case where there are two loops and LICM is hoisting an
; instruction from one loop into the other loop! This is obviously bad and
; happens because preheader insertion doesn't insert a preheader for this
; case... bad.
; RUN: opt < %s -licm -loop-deletion -simplifycfg -S | \
; RUN: not grep "br "
define i32 @main(i32 %argc) {
; <label>:0
br label %bb5
bb5: ; preds = %bb5, %0
%I = phi i32 [ 0, %0 ], [ %I2, %bb5 ] ; <i32> [#uses=1]
%I2 = add i32 %I, 1 ; <i32> [#uses=2]
%c = icmp eq i32 %I2, 10 ; <i1> [#uses=1]
br i1 %c, label %bb5, label %bb8
bb8: ; preds = %bb8, %bb5
%cann-indvar = phi i32 [ 0, %bb8 ], [ 0, %bb5 ] ; <i32> [#uses=0]
%X = add i32 %argc, %argc ; <i32> [#uses=1]
br i1 false, label %bb8, label %bb10
bb10: ; preds = %bb8
ret i32 %X
}

View File

@@ -0,0 +1,15 @@
; LICM is adding stores before phi nodes. bad.
; RUN: opt < %s -licm
define i1 @test(i1 %c) {
; <label>:0
br i1 %c, label %Loop, label %Out
Loop: ; preds = %Loop, %0
store i32 0, i32* null
br i1 %c, label %Loop, label %Out
Out: ; preds = %Loop, %0
%X = phi i1 [ %c, %0 ], [ true, %Loop ] ; <i1> [#uses=1]
ret i1 %X
}

View File

@@ -0,0 +1,15 @@
; Test that hoisting is disabled for pointers of different types...
;
; RUN: opt < %s -licm
define void @test(i32* %P) {
br label %Loop
Loop: ; preds = %Loop, %0
store i32 5, i32* %P
%P2 = bitcast i32* %P to i8* ; <i8*> [#uses=1]
store i8 4, i8* %P2
br i1 true, label %Loop, label %Out
Out: ; preds = %Loop
ret void
}

View File

@@ -0,0 +1,23 @@
; This testcase tests for a problem where LICM hoists loads out of a loop
; despite the fact that calls to unknown functions may modify what is being
; loaded from. Basically if the load gets hoisted, the subtract gets turned
; into a constant zero.
;
; RUN: opt < %s -licm -gvn -instcombine -S | grep load
@X = global i32 7 ; <i32*> [#uses=2]
declare void @foo()
define i32 @test(i1 %c) {
%A = load i32, i32* @X ; <i32> [#uses=1]
br label %Loop
Loop: ; preds = %Loop, %0
call void @foo( )
;; Should not hoist this load!
%B = load i32, i32* @X ; <i32> [#uses=1]
br i1 %c, label %Loop, label %Out
Out: ; preds = %Loop
%C = sub i32 %A, %B ; <i32> [#uses=1]
ret i32 %C
}

View File

@@ -0,0 +1,16 @@
; RUN: opt < %s -licm | lli -force-interpreter
define i32 @main() {
entry:
br label %Loop
Loop: ; preds = %LoopCont, %entry
br i1 true, label %LoopCont, label %Out
LoopCont: ; preds = %Loop
%X = add i32 1, 0 ; <i32> [#uses=1]
br i1 true, label %Out, label %Loop
Out: ; preds = %LoopCont, %Loop
%V = phi i32 [ 2, %Loop ], [ %X, %LoopCont ] ; <i32> [#uses=1]
%V2 = sub i32 %V, 1 ; <i32> [#uses=1]
ret i32 %V2
}

View File

@@ -0,0 +1,19 @@
; RUN: opt < %s -globals-aa -licm -disable-output
@PL_regcomp_parse = internal global i8* null ; <i8**> [#uses=2]
define void @test() {
br label %Outer
Outer: ; preds = %Next, %0
br label %Inner
Inner: ; preds = %Inner, %Outer
%tmp.114.i.i.i = load i8*, i8** @PL_regcomp_parse ; <i8*> [#uses=1]
%tmp.115.i.i.i = load i8, i8* %tmp.114.i.i.i ; <i8> [#uses=0]
store i8* null, i8** @PL_regcomp_parse
br i1 false, label %Inner, label %Next
Next: ; preds = %Inner
br i1 false, label %Outer, label %Exit
Exit: ; preds = %Next
ret void
}

View File

@@ -0,0 +1,20 @@
; RUN: opt < %s -licm -disable-output
%struct.roadlet = type { i8*, %struct.vehicle*, [8 x %struct.roadlet*], [8 x %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)*] }
%struct.vehicle = type { %struct.roadlet*, i8*, i32, i32, %union.._631., i32 }
%union.._631. = type { i32 }
declare %struct.roadlet* @_Z11return_nullP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, i32)
declare %struct.roadlet* @_Z14lane_switch_okP7roadletP7vehicle9direction(%struct.roadlet*, %struct.vehicle*, i32)
define void @main() {
__main.entry:
br label %invoke_cont.3
invoke_cont.3: ; preds = %invoke_cont.3, %__main.entry
%tmp.34.i.i502.7 = getelementptr %struct.roadlet, %struct.roadlet* null, i32 0, i32 3, i32 7 ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)**> [#uses=1]
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** %tmp.34.i.i502.7
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z14lane_switch_okP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** null
%tmp.4.i.i339 = getelementptr %struct.roadlet, %struct.roadlet* null, i32 0, i32 3, i32 undef ; <%struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)**> [#uses=1]
store %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)* @_Z11return_nullP7roadletP7vehicle9direction, %struct.roadlet* (%struct.roadlet*, %struct.vehicle*, i32)** %tmp.4.i.i339
br label %invoke_cont.3
}

View File

@@ -0,0 +1,148 @@
; RUN: opt < %s -licm -disable-output
; PR908
; END.
%struct.alloc_chain = type { i8*, %struct.alloc_chain* }
%struct.oggpack_buffer = type { i32, i32, i8*, i8*, i32 }
%struct.vorbis_block = type { float**, %struct.oggpack_buffer, i32, i32, i32, i32, i32, i32, i64, i64, %struct.vorbis_dsp_state*, i8*, i32, i32, i32, %struct.alloc_chain*, i32, i32, i32, i32, i8* }
%struct.vorbis_dsp_state = type { i32, %struct.vorbis_info*, float**, float**, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, i64, i64, i64, i64, i64, i8* }
%struct.vorbis_info = type { i32, i32, i32, i32, i32, i32, i32, i8* }
define fastcc void @_01forward() {
entry:
br i1 false, label %bb222.preheader, label %bb241
cond_true67: ; preds = %cond_true87
br label %cond_next80
cond_next80: ; preds = %cond_true87, %cond_true67
br label %bb83
bb83.preheader: ; preds = %cond_true226
br i1 false, label %bb83.us.preheader, label %bb83.preheader1
bb83.us.preheader: ; preds = %bb83.preheader
br label %bb83.us
bb83.us: ; preds = %cond_next80.us, %bb83.us.preheader
br i1 false, label %cond_true87.us, label %cond_next92.loopexit2
cond_next80.us: ; preds = %bb59.loopexit.us, %cond_true67.us
br label %bb83.us
cond_true67.us: ; preds = %bb59.loopexit.us
br label %cond_next80.us
cond_next.us: ; preds = %cond_true56.us, %cond_true38.us
br i1 false, label %cond_true56.us, label %bb59.loopexit.us
cond_true38.us: ; preds = %cond_true56.us
br label %cond_next.us
cond_true56.us: ; preds = %cond_true87.us, %cond_next.us
br i1 false, label %cond_true38.us, label %cond_next.us
cond_true87.us: ; preds = %bb83.us
br label %cond_true56.us
bb59.loopexit.us: ; preds = %cond_next.us
br i1 false, label %cond_true67.us, label %cond_next80.us
bb83.preheader1: ; preds = %bb83.preheader
br label %bb83
bb83: ; preds = %bb83.preheader1, %cond_next80
br i1 false, label %cond_next92.loopexit, label %cond_true87
cond_true87: ; preds = %bb83
br i1 false, label %cond_true67, label %cond_next80
cond_next92.loopexit: ; preds = %bb83
br label %cond_next92
cond_next92.loopexit2: ; preds = %bb83.us
br label %cond_next92
cond_next92: ; preds = %cond_true226, %cond_next92.loopexit2, %cond_next92.loopexit
br i1 false, label %cond_true218.loopexit, label %bb222
cond_true139: ; preds = %cond_true202
br i1 false, label %cond_next195, label %cond_true155
cond_true155: ; preds = %cond_true139
br i1 false, label %cond_true249.i.preheader, label %_encodepart.exit
cond_true.i: ; preds = %cond_true115.i
br i1 false, label %bb60.i.preheader, label %cond_next97.i
bb60.i.preheader: ; preds = %cond_true.i
br label %bb60.i
bb60.i: ; preds = %cond_true63.i, %bb60.i.preheader
br i1 false, label %cond_true63.i, label %cond_next97.i.loopexit
cond_true63.i: ; preds = %bb60.i
br i1 false, label %bb60.i, label %cond_next97.i.loopexit
bb86.i.preheader: ; preds = %cond_true115.i
br label %bb86.i
bb86.i: ; preds = %cond_true93.i, %bb86.i.preheader
br i1 false, label %cond_true93.i, label %cond_next97.i.loopexit3
cond_true93.i: ; preds = %bb86.i
br i1 false, label %cond_next97.i.loopexit3, label %bb86.i
cond_next97.i.loopexit: ; preds = %cond_true63.i, %bb60.i
br label %cond_next97.i
cond_next97.i.loopexit3: ; preds = %cond_true93.i, %bb86.i
br label %cond_next97.i
cond_next97.i: ; preds = %cond_next97.i.loopexit3, %cond_next97.i.loopexit, %cond_true.i
br i1 false, label %bb118.i.loopexit, label %cond_true115.i
cond_true115.i.preheader: ; preds = %cond_true249.i
br label %cond_true115.i
cond_true115.i: ; preds = %cond_true115.i.preheader, %cond_next97.i
br i1 false, label %cond_true.i, label %bb86.i.preheader
bb118.i.loopexit: ; preds = %cond_next97.i
br label %bb118.i
bb118.i: ; preds = %cond_true249.i, %bb118.i.loopexit
br i1 false, label %cond_next204.i, label %cond_true128.i
cond_true128.i: ; preds = %bb118.i
br i1 false, label %cond_true199.i.preheader, label %cond_next204.i
cond_true199.i.preheader: ; preds = %cond_true128.i
br label %cond_true199.i
cond_true199.i.us: ; No predecessors!
br i1 false, label %cond_true167.i.us, label %cond_next187.i.us
cond_next187.i.us: ; preds = %bb170.i.loopexit.us, %bb170.i.us.cond_next187.i.us_crit_edge, %cond_true199.i.us
unreachable
bb170.i.us.cond_next187.i.us_crit_edge: ; preds = %bb170.i.loopexit.us
br label %cond_next187.i.us
cond_true167.i.us: ; preds = %cond_true167.i.us, %cond_true199.i.us
br i1 false, label %cond_true167.i.us, label %bb170.i.loopexit.us
bb170.i.loopexit.us: ; preds = %cond_true167.i.us
br i1 false, label %cond_next187.i.us, label %bb170.i.us.cond_next187.i.us_crit_edge
cond_true199.i: ; preds = %cond_true199.i, %cond_true199.i.preheader
br i1 false, label %cond_next204.i.loopexit, label %cond_true199.i
cond_next204.i.loopexit: ; preds = %cond_true199.i
br label %cond_next204.i
cond_next204.i: ; preds = %cond_next204.i.loopexit, %cond_true128.i, %bb118.i
br label %bb233.i
cond_true230.i: ; No predecessors!
%exitcond155 = icmp eq i32 0, %tmp16.i ; <i1> [#uses=0]
unreachable
bb233.i: ; preds = %cond_next204.i
br i1 false, label %_encodepart.exit.loopexit, label %cond_true249.i
cond_true249.i.preheader: ; preds = %cond_true155
br label %cond_true249.i
cond_true249.i: ; preds = %cond_true249.i.preheader, %bb233.i
%tmp16.i = bitcast i32 0 to i32 ; <i32> [#uses=1]
br i1 false, label %cond_true115.i.preheader, label %bb118.i
_encodepart.exit.loopexit: ; preds = %bb233.i
br label %_encodepart.exit
_encodepart.exit: ; preds = %_encodepart.exit.loopexit, %cond_true155
br label %cond_next195
cond_next195: ; preds = %cond_true202, %_encodepart.exit, %cond_true139
br i1 false, label %bb205.loopexit, label %cond_true202
cond_true202.preheader: ; preds = %cond_true218
br label %cond_true202
cond_true202: ; preds = %cond_true202.preheader, %cond_next195
br i1 false, label %cond_next195, label %cond_true139
bb205.loopexit: ; preds = %cond_next195
br label %bb205
bb205: ; preds = %cond_true218, %bb205.loopexit
br i1 false, label %cond_true218, label %bb222.outer105.loopexit
cond_true218.loopexit: ; preds = %cond_next92
br label %cond_true218
cond_true218: ; preds = %cond_true218.loopexit, %bb205
br i1 false, label %cond_true202.preheader, label %bb205
bb222.preheader: ; preds = %entry
br label %bb222.outer
bb222.outer: ; preds = %bb229, %bb222.preheader
br label %bb222.outer105
bb222.outer105.loopexit: ; preds = %bb205
br label %bb222.outer105
bb222.outer105: ; preds = %bb222.outer105.loopexit, %bb222.outer
br label %bb222
bb222: ; preds = %bb222.outer105, %cond_next92
br i1 false, label %cond_true226, label %bb229
cond_true226: ; preds = %bb222
br i1 false, label %bb83.preheader, label %cond_next92
bb229: ; preds = %bb222
br i1 false, label %bb222.outer, label %bb241.loopexit
bb241.loopexit: ; preds = %bb229
br label %bb241
bb241: ; preds = %bb241.loopexit, %entry
ret void
}

View File

@@ -0,0 +1,56 @@
; RUN: opt < %s -licm -S | grep "store volatile"
; PR1435
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
target triple = "i686-apple-darwin8"
define void @Transpose(i32* %DataIn, i32* %DataOut) {
entry:
%buffer = alloca [64 x i32], align 16 ; <[64 x i32]*> [#uses=2]
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
br label %bb6
bb: ; preds = %bb6
%tmp2 = load volatile i32, i32* %DataIn ; <i32> [#uses=1]
%tmp3 = getelementptr [64 x i32], [64 x i32]* %buffer, i32 0, i32 %i.0 ; <i32*> [#uses=1]
store i32 %tmp2, i32* %tmp3
%tmp5 = add i32 %i.0, 1 ; <i32> [#uses=1]
br label %bb6
bb6: ; preds = %bb, %entry
%i.0 = phi i32 [ 0, %entry ], [ %tmp5, %bb ] ; <i32> [#uses=3]
%tmp8 = icmp sle i32 %i.0, 63 ; <i1> [#uses=1]
%tmp89 = zext i1 %tmp8 to i8 ; <i8> [#uses=1]
%toBool = icmp ne i8 %tmp89, 0 ; <i1> [#uses=1]
br i1 %toBool, label %bb, label %bb30
bb12: ; preds = %bb22
%tmp14 = mul i32 %j.1, 8 ; <i32> [#uses=1]
%tmp16 = add i32 %tmp14, %i.1 ; <i32> [#uses=1]
%tmp17 = getelementptr [64 x i32], [64 x i32]* %buffer, i32 0, i32 %tmp16 ; <i32*> [#uses=1]
%tmp18 = load i32, i32* %tmp17 ; <i32> [#uses=1]
store volatile i32 %tmp18, i32* %DataOut
%tmp21 = add i32 %j.1, 1 ; <i32> [#uses=1]
br label %bb22
bb22: ; preds = %bb30, %bb12
%j.1 = phi i32 [ %tmp21, %bb12 ], [ 0, %bb30 ] ; <i32> [#uses=4]
%tmp24 = icmp sle i32 %j.1, 7 ; <i1> [#uses=1]
%tmp2425 = zext i1 %tmp24 to i8 ; <i8> [#uses=1]
%toBool26 = icmp ne i8 %tmp2425, 0 ; <i1> [#uses=1]
br i1 %toBool26, label %bb12, label %bb27
bb27: ; preds = %bb22
%tmp29 = add i32 %i.1, 1 ; <i32> [#uses=1]
br label %bb30
bb30: ; preds = %bb27, %bb6
%j.0 = phi i32 [ %j.1, %bb27 ], [ undef, %bb6 ] ; <i32> [#uses=0]
%i.1 = phi i32 [ %tmp29, %bb27 ], [ 0, %bb6 ] ; <i32> [#uses=3]
%tmp32 = icmp sle i32 %i.1, 7 ; <i1> [#uses=1]
%tmp3233 = zext i1 %tmp32 to i8 ; <i8> [#uses=1]
%toBool34 = icmp ne i8 %tmp3233, 0 ; <i1> [#uses=1]
br i1 %toBool34, label %bb22, label %return
return: ; preds = %bb30
ret void
}

View File

@@ -0,0 +1,39 @@
; RUN: opt < %s -licm -loop-unswitch -disable-output
%struct.III_scalefac_t = type { [22 x i32], [13 x [3 x i32]] }
%struct.gr_info = type { i32, i32, i32, i32, i32, i32, i32, i32, [3 x i32], [3 x i32], i32, i32, i32, i32, i32, i32, i32, i32, i32, i32*, [4 x i32] }
define i32 @scale_bitcount_lsf(%struct.III_scalefac_t* %scalefac, %struct.gr_info* %cod_info) {
entry:
br i1 false, label %bb28, label %bb133.preheader
bb133.preheader: ; preds = %entry
ret i32 0
bb28: ; preds = %entry
br i1 false, label %bb63.outer, label %bb79
bb63.outer: ; preds = %bb73, %bb28
br i1 false, label %bb35, label %bb73
bb35: ; preds = %cond_next60, %bb63.outer
%window.34 = phi i32 [ %tmp62, %cond_next60 ], [ 0, %bb63.outer ] ; <i32> [#uses=1]
%tmp44 = getelementptr [4 x i32], [4 x i32]* null, i32 0, i32 0 ; <i32*> [#uses=1]
%tmp46 = load i32, i32* %tmp44, align 4 ; <i32> [#uses=0]
br i1 false, label %cond_true50, label %cond_next60
cond_true50: ; preds = %bb35
%tmp59 = getelementptr [4 x i32], [4 x i32]* null, i32 0, i32 0 ; <i32*> [#uses=1]
store i32 0, i32* %tmp59, align 4
br label %cond_next60
cond_next60: ; preds = %cond_true50, %bb35
%tmp62 = add i32 %window.34, 1 ; <i32> [#uses=1]
br i1 false, label %bb35, label %bb73
bb73: ; preds = %cond_next60, %bb63.outer
%tmp76 = icmp slt i32 0, 0 ; <i1> [#uses=1]
br i1 %tmp76, label %bb63.outer, label %bb79
bb79: ; preds = %bb73, %bb28
ret i32 0
}

View File

@@ -0,0 +1,61 @@
; ModuleID = 'PR1657.bc'
; Do not promote getelementptr because it may exposes load from a null pointer
; and store from a null pointer which are covered by
; icmp eq %struct.decision* null, null condition.
; RUN: opt < %s -licm -S | not grep promoted
%struct.decision = type { i8, %struct.decision* }
define i32 @main() {
entry:
br label %blah.i
blah.i: ; preds = %cond_true.i, %entry
%tmp3.i = icmp eq %struct.decision* null, null ; <i1> [#uses=1]
br i1 %tmp3.i, label %clear_modes.exit, label %cond_true.i
cond_true.i: ; preds = %blah.i
%tmp1.i = getelementptr %struct.decision, %struct.decision* null, i32 0, i32 0 ; <i8*> [#uses=1]
store i8 0, i8* %tmp1.i
br label %blah.i
clear_modes.exit: ; preds = %blah.i
call void @exit( i32 0 )
unreachable
}
define i32 @f(i8* %ptr) {
entry:
br label %loop.head
loop.head: ; preds = %cond.true, %entry
%x = phi i8* [ %ptr, %entry ], [ %ptr.i, %cond.true ] ; <i8*> [#uses=1]
%tmp3.i = icmp ne i8* %ptr, %x ; <i1> [#uses=1]
br i1 %tmp3.i, label %cond.true, label %exit
cond.true: ; preds = %loop.head
%ptr.i = getelementptr i8, i8* %ptr, i32 0 ; <i8*> [#uses=2]
store i8 0, i8* %ptr.i
br label %loop.head
exit: ; preds = %loop.head
ret i32 0
}
define i32 @f2(i8* %p, i8* %q) {
entry:
br label %loop.head
loop.head: ; preds = %cond.true, %entry
%tmp3.i = icmp eq i8* null, %q ; <i1> [#uses=1]
br i1 %tmp3.i, label %exit, label %cond.true
cond.true: ; preds = %loop.head
%ptr.i = getelementptr i8, i8* %p, i32 0 ; <i8*> [#uses=2]
store i8 0, i8* %ptr.i
br label %loop.head
exit: ; preds = %loop.head
ret i32 0
}
declare void @exit(i32)

View File

@@ -0,0 +1,46 @@
; Do not promote null value because it may be unsafe to do so.
; RUN: opt < %s -licm -S | not grep promoted
define i32 @f(i32 %foo, i32 %bar, i32 %com) {
entry:
%tmp2 = icmp eq i32 %foo, 0 ; <i1> [#uses=1]
br i1 %tmp2, label %cond_next, label %cond_true
cond_true: ; preds = %entry
br label %return
cond_next: ; preds = %entry
br label %bb
bb: ; preds = %bb15, %cond_next
switch i32 %bar, label %bb15 [
i32 1, label %bb6
]
bb6: ; preds = %bb
%tmp8 = icmp eq i32 %com, 0 ; <i1> [#uses=1]
br i1 %tmp8, label %cond_next14, label %cond_true11
cond_true11: ; preds = %bb6
br label %return
cond_next14: ; preds = %bb6
store i8 0, i8* null
br label %bb15
bb15: ; preds = %cond_next14, %bb
br label %bb
return: ; preds = %cond_true11, %cond_true
%storemerge = phi i32 [ 0, %cond_true ], [ undef, %cond_true11 ] ; <i32> [#uses=1]
ret i32 %storemerge
}
define i32 @kdMain() {
entry:
%tmp1 = call i32 @f( i32 0, i32 1, i32 1 ) ; <i32> [#uses=0]
call void @exit( i32 0 )
unreachable
}
declare void @exit(i32)

View File

@@ -0,0 +1,23 @@
; RUN: opt < %s -licm -S | FileCheck %s
; Promote value if at least one use is safe
define i32 @f2(i32* %p, i8* %q) {
entry:
br label %loop.head
loop.head: ; preds = %cond.true, %entry
store i32 20, i32* %p
%tmp3.i = icmp eq i8* null, %q ; <i1> [#uses=1]
br i1 %tmp3.i, label %exit, label %cond.true
cond.true: ; preds = %loop.head
store i32 40, i32* %p
br label %loop.head
; CHECK: exit:
; CHECK: store i32 20, i32* %p
exit: ; preds = %loop.head
ret i32 0
}

View File

@@ -0,0 +1,30 @@
; RUN: opt < %s -licm -disable-output
; PR2346
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-pc-linux-gnu"
%struct._zval_struct = type { %union._double, i32, i8, i8, i8, i8 }
%union._double = type { double }
define i8* @zend_fetch_resource(%struct._zval_struct** %passed_id, i32 %default_id, i8* %resource_type_name, i32* %found_resource_type, i32 %num_resource_types, ...) {
entry:
br label %whilebody.i.i
whilebody.i.i: ; preds = %whilebody.i.i, %entry
br i1 false, label %ifthen.i.i, label %whilebody.i.i
ifthen.i.i: ; preds = %whilebody.i.i
br label %forcond
forcond: ; preds = %forbody, %ifthen.i.i
br i1 false, label %forbody, label %afterfor
forbody: ; preds = %forcond
va_arg i8** null, i32 ; <i32>:0 [#uses=0]
br i1 false, label %ifthen59, label %forcond
ifthen59: ; preds = %forbody
unreachable
afterfor: ; preds = %forcond
ret i8* null
}

View File

@@ -0,0 +1,39 @@
; RUN: opt < %s -basicaa -licm -S | FileCheck %s
@a = external constant float*
define void @test(i32 %count) {
entry:
br label %forcond
; CHECK: %tmp3 = load float*, float** @a
; CHECK: br label %forcond
forcond:
%i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ]
%cmp = icmp ult i32 %i.0, %count
br i1 %cmp, label %forbody, label %afterfor
; CHECK: %i.0 = phi i32 [ 0, %entry ], [ %inc, %forbody ]
; CHECK: %cmp = icmp ult i32 %i.0, %count
; CHECK: br i1 %cmp, label %forbody, label %afterfor
forbody:
%tmp3 = load float*, float** @a
%arrayidx = getelementptr float, float* %tmp3, i32 %i.0
%tmp7 = uitofp i32 %i.0 to float
store float %tmp7, float* %arrayidx
%inc = add i32 %i.0, 1
br label %forcond
; CHECK: %arrayidx = getelementptr float, float* %tmp3, i32 %i.0
; CHECK: %tmp7 = uitofp i32 %i.0 to float
; CHECK: store float %tmp7, float* %arrayidx
; CHECK: %inc = add i32 %i.0, 1
; CHECK: br label %forcond
afterfor:
ret void
}
; CHECK: ret void

View File

@@ -0,0 +1,21 @@
; Test for rdar://7452967
; RUN: opt < %s -licm -disable-output
define void @foo (i8* %v)
{
entry:
br i1 undef, label %preheader, label %return
preheader:
br i1 undef, label %loop, label %return
loop:
indirectbr i8* undef, [label %preheader, label %stuff]
stuff:
%0 = load i8, i8* undef, align 1
br label %loop
return:
ret void
}

View File

@@ -0,0 +1,32 @@
; RUN: opt < %s -basicaa -licm -S | FileCheck %s
; PR9630
@g_39 = external global i16, align 2
declare i32* @func_84(i32** nocapture) nounwind readonly
declare i32** @func_108(i32*** nocapture) nounwind readonly
define void @func() nounwind {
entry:
br label %for.body4.lr.ph
for.body4.lr.ph:
br label %for.body4
; CHECK: for.body4:
; CHECK: load volatile i16, i16* @g_39
for.body4:
%l_612.11 = phi i32* [ undef, %for.body4.lr.ph ], [ %call19, %for.body4 ]
%tmp7 = load volatile i16, i16* @g_39, align 2
%call = call i32** @func_108(i32*** undef)
%call19 = call i32* @func_84(i32** %call)
br i1 false, label %for.body4, label %for.cond.loopexit
for.cond.loopexit:
br i1 false, label %for.body4.lr.ph, label %for.end26
for.end26:
ret void
}

Some files were not shown because too many files have changed in this diff Show More