2003-08-17 21:37:57 +02:00
|
|
|
; This test checks to make sure that 'br X, Dest, Dest' is folded into
|
|
|
|
; 'br Dest'. This can only happen after the 'Z' block is eliminated. This is
|
|
|
|
; due to the fact that the SimplifyCFG function does not use
|
|
|
|
; the ConstantFoldTerminator function.
|
|
|
|
|
2009-09-11 20:01:28 +02:00
|
|
|
; RUN: opt < %s -simplifycfg -S | \
|
2008-05-02 01:50:07 +02:00
|
|
|
; RUN: not grep {br i1 %c2}
|
2003-08-17 21:37:57 +02:00
|
|
|
|
2008-03-10 08:21:50 +01:00
|
|
|
declare void @noop()
|
2003-08-17 21:37:57 +02:00
|
|
|
|
2008-03-10 08:21:50 +01:00
|
|
|
define i32 @test(i1 %c1, i1 %c2) {
|
|
|
|
call void @noop( )
|
|
|
|
br i1 %c1, label %A, label %Y
|
|
|
|
A: ; preds = %0
|
|
|
|
call void @noop( )
|
|
|
|
br i1 %c2, label %Z, label %X
|
|
|
|
Z: ; preds = %A
|
2003-08-17 21:37:57 +02:00
|
|
|
br label %X
|
2008-03-10 08:21:50 +01:00
|
|
|
X: ; preds = %Y, %Z, %A
|
|
|
|
call void @noop( )
|
|
|
|
ret i32 0
|
|
|
|
Y: ; preds = %0
|
|
|
|
call void @noop( )
|
2003-08-17 21:37:57 +02:00
|
|
|
br label %X
|
|
|
|
}
|
2008-03-10 08:21:50 +01:00
|
|
|
|