blob: 7564cfac63a527890495de2829b36fbbca7f089a [file] [log] [blame]
Dan Gohmanf17a25c2007-07-18 16:29:46 +00001; This test checks to make sure that 'br X, Dest, Dest' is folded into
2; 'br Dest'. This can only happen after the 'Z' block is eliminated. This is
3; due to the fact that the SimplifyCFG function does not use
4; the ConstantFoldTerminator function.
5
Tanya Lattner003eae52008-03-10 07:21:50 +00006; RUN: llvm-as < %s | opt -simplifycfg | llvm-dis | \
Dan Gohmanf17a25c2007-07-18 16:29:46 +00007; RUN: not grep {br bool %c2}
8
Tanya Lattner003eae52008-03-10 07:21:50 +00009declare void @noop()
Dan Gohmanf17a25c2007-07-18 16:29:46 +000010
Tanya Lattner003eae52008-03-10 07:21:50 +000011define i32 @test(i1 %c1, i1 %c2) {
12 call void @noop( )
13 br i1 %c1, label %A, label %Y
14A: ; preds = %0
15 call void @noop( )
16 br i1 %c2, label %Z, label %X
17Z: ; preds = %A
Dan Gohmanf17a25c2007-07-18 16:29:46 +000018 br label %X
Tanya Lattner003eae52008-03-10 07:21:50 +000019X: ; preds = %Y, %Z, %A
20 call void @noop( )
21 ret i32 0
22Y: ; preds = %0
23 call void @noop( )
Dan Gohmanf17a25c2007-07-18 16:29:46 +000024 br label %X
25}
Tanya Lattner003eae52008-03-10 07:21:50 +000026