mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-01 16:33:37 +01:00
d04a608a73
- Eliminate redundant successors. - Convert an indirectbr with one successor into a direct branch. Also, generalize SimplifyCFG to be able to be run on a function entry block. It knows quite a few simplifications which are applicable to the entry block, and it only needs a few checks to avoid trouble with the entry block. llvm-svn: 111060
59 lines
1.1 KiB
LLVM
59 lines
1.1 KiB
LLVM
; Test CFG simplify removal of branch instructions.
|
|
;
|
|
; RUN: opt < %s -simplifycfg -S | FileCheck %s
|
|
|
|
define void @test1() {
|
|
br label %BB1
|
|
BB1: ; preds = %0
|
|
ret void
|
|
; CHECK: @test1
|
|
; CHECK-NEXT: ret void
|
|
}
|
|
|
|
define void @test2() {
|
|
ret void
|
|
BB1: ; No predecessors!
|
|
ret void
|
|
; CHECK: @test2
|
|
; CHECK-NEXT: ret void
|
|
; CHECK-NEXT: }
|
|
}
|
|
|
|
define void @test3(i1 %T) {
|
|
br i1 %T, label %BB1, label %BB1
|
|
BB1: ; preds = %0, %0
|
|
ret void
|
|
; CHECK: @test3
|
|
; CHECK-NEXT: ret void
|
|
}
|
|
|
|
|
|
define void @test4() {
|
|
br label %return
|
|
return:
|
|
ret void
|
|
; CHECK: @test4
|
|
; CHECK-NEXT: ret void
|
|
}
|
|
@test4g = global i8* blockaddress(@test4, %return)
|
|
|
|
|
|
; PR5795
|
|
define void @test5(i32 %A) {
|
|
switch i32 %A, label %return [
|
|
i32 2, label %bb
|
|
i32 10, label %bb1
|
|
]
|
|
|
|
bb: ; preds = %entry
|
|
ret void
|
|
|
|
bb1: ; preds = %entry
|
|
ret void
|
|
|
|
return: ; preds = %entry
|
|
ret void
|
|
; CHECK: @test5
|
|
; CHECK-NEXT: ret void
|
|
}
|