2009-09-12 02:01:28 +08:00
|
|
|
; RUN: opt < %s -simplifycfg -adce -S | \
|
2012-07-03 03:09:46 +08:00
|
|
|
; RUN: not grep "call void @f1"
|
2007-04-15 17:21:47 +08:00
|
|
|
; END.
|
|
|
|
|
2008-03-18 11:45:45 +08:00
|
|
|
declare void @f1()
|
2005-09-20 07:48:04 +08:00
|
|
|
|
2008-03-18 11:45:45 +08:00
|
|
|
declare void @f2()
|
2005-09-20 07:48:04 +08:00
|
|
|
|
2008-03-18 11:45:45 +08:00
|
|
|
declare void @f3()
|
|
|
|
|
|
|
|
declare void @f4()
|
|
|
|
|
|
|
|
define i32 @test1(i32 %X, i1 %D) {
|
2005-09-20 08:41:55 +08:00
|
|
|
E:
|
2008-03-18 11:45:45 +08:00
|
|
|
%C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
|
|
|
|
br i1 %C, label %T, label %F
|
|
|
|
T: ; preds = %A, %E
|
|
|
|
br i1 %C, label %B, label %A
|
|
|
|
A: ; preds = %T
|
|
|
|
call void @f1( )
|
|
|
|
br i1 %D, label %T, label %F
|
|
|
|
B: ; preds = %T
|
|
|
|
call void @f2( )
|
|
|
|
ret i32 345
|
|
|
|
F: ; preds = %A, %E
|
|
|
|
call void @f3( )
|
|
|
|
ret i32 123
|
2005-09-20 08:41:55 +08:00
|
|
|
}
|
|
|
|
|
2008-03-18 11:45:45 +08:00
|
|
|
define i32 @test2(i32 %X, i1 %D) {
|
2005-09-20 07:48:04 +08:00
|
|
|
E:
|
2008-03-18 11:45:45 +08:00
|
|
|
%C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
|
|
|
|
br i1 %C, label %T, label %F
|
|
|
|
T: ; preds = %A, %E
|
|
|
|
%P = phi i1 [ true, %E ], [ %C, %A ] ; <i1> [#uses=1]
|
|
|
|
br i1 %P, label %B, label %A
|
|
|
|
A: ; preds = %T
|
|
|
|
call void @f1( )
|
|
|
|
br i1 %D, label %T, label %F
|
|
|
|
B: ; preds = %T
|
|
|
|
call void @f2( )
|
|
|
|
ret i32 345
|
|
|
|
F: ; preds = %A, %E
|
|
|
|
call void @f3( )
|
|
|
|
ret i32 123
|
2005-09-20 07:48:04 +08:00
|
|
|
}
|
|
|
|
|
2008-03-18 11:45:45 +08:00
|
|
|
define i32 @test3(i32 %X, i1 %D, i32* %AP, i32* %BP) {
|
2005-09-20 09:43:41 +08:00
|
|
|
E:
|
2008-03-18 11:45:45 +08:00
|
|
|
%C = icmp eq i32 %X, 0 ; <i1> [#uses=2]
|
|
|
|
br i1 %C, label %T, label %F
|
|
|
|
T: ; preds = %A, %E
|
|
|
|
call void @f3( )
|
2015-02-28 05:17:42 +08:00
|
|
|
%XX = load i32, i32* %AP ; <i32> [#uses=1]
|
2008-03-18 11:45:45 +08:00
|
|
|
store i32 %XX, i32* %BP
|
|
|
|
br i1 %C, label %B, label %A
|
|
|
|
A: ; preds = %T
|
|
|
|
call void @f1( )
|
|
|
|
br i1 %D, label %T, label %F
|
|
|
|
B: ; preds = %T
|
|
|
|
call void @f2( )
|
|
|
|
ret i32 345
|
|
|
|
F: ; preds = %A, %E
|
|
|
|
call void @f3( )
|
|
|
|
ret i32 123
|
2005-09-20 09:43:41 +08:00
|
|
|
}
|