2009-12-22 06:04:26 +00:00
|
|
|
; Test CFG simplify removal of branch instructions.
|
2002-05-06 02:37:38 +00:00
|
|
|
;
|
2009-12-22 06:04:26 +00:00
|
|
|
; RUN: opt < %s -simplifycfg -S | FileCheck %s
|
2002-05-06 02:37:38 +00:00
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test1() {
|
|
|
|
br label %BB1
|
|
|
|
BB1: ; preds = %0
|
|
|
|
ret void
|
2009-12-22 06:04:26 +00:00
|
|
|
; CHECK: @test1
|
|
|
|
; CHECK-NEXT: ret void
|
2002-05-06 02:37:38 +00:00
|
|
|
}
|
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test2() {
|
|
|
|
ret void
|
|
|
|
BB1: ; No predecessors!
|
|
|
|
ret void
|
2009-12-22 06:04:26 +00:00
|
|
|
; CHECK: @test2
|
|
|
|
; CHECK-NEXT: ret void
|
|
|
|
; CHECK-NEXT: }
|
2002-05-06 02:37:38 +00:00
|
|
|
}
|
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test3(i1 %T) {
|
|
|
|
br i1 %T, label %BB1, label %BB1
|
|
|
|
BB1: ; preds = %0, %0
|
|
|
|
ret void
|
2009-12-22 06:04:26 +00:00
|
|
|
; CHECK: @test3
|
|
|
|
; CHECK-NEXT: ret void
|
2002-05-06 02:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-10-30 22:39:36 +00:00
|
|
|
define void @test4() {
|
2009-12-22 06:04:26 +00:00
|
|
|
br label %return
|
2009-10-30 22:39:36 +00:00
|
|
|
return:
|
2009-12-22 06:04:26 +00:00
|
|
|
ret void
|
|
|
|
; CHECK: @test4
|
|
|
|
; CHECK-NEXT: ret void
|
2009-10-30 22:39:36 +00:00
|
|
|
}
|
|
|
|
@test4g = global i8* blockaddress(@test4, %return)
|
2009-12-22 06:04:26 +00:00
|
|
|
|
|
|
|
|
2009-12-22 06:07:30 +00:00
|
|
|
; 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
|
|
|
|
}
|