Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; 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 | |
| 6 | ; RUN: opt < %s -simplifycfg -S | FileCheck %s |
| 7 | |
| 8 | ; CHECK-NOT: br i1 %c2 |
| 9 | |
| 10 | declare void @noop() |
| 11 | |
| 12 | define i32 @test(i1 %c1, i1 %c2) { |
| 13 | call void @noop( ) |
| 14 | br i1 %c1, label %A, label %Y |
| 15 | A: ; preds = %0 |
| 16 | call void @noop( ) |
| 17 | br i1 %c2, label %Z, label %X |
| 18 | Z: ; preds = %A |
| 19 | br label %X |
| 20 | X: ; preds = %Y, %Z, %A |
| 21 | call void @noop( ) |
| 22 | ret i32 0 |
| 23 | Y: ; preds = %0 |
| 24 | call void @noop( ) |
| 25 | br label %X |
| 26 | } |
| 27 | |