2011-03-15 02:23:35 +00:00
|
|
|
; RUN: opt < %s -simplifycfg -S | FileCheck %s
|
2004-10-18 04:06:41 +00:00
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test1(i1 %C, i1* %BP) {
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test1(
|
2011-03-15 02:23:35 +00:00
|
|
|
; CHECK: entry:
|
|
|
|
; CHECK-NEXT: ret void
|
|
|
|
entry:
|
2008-03-18 03:45:45 +00:00
|
|
|
br i1 %C, label %T, label %F
|
2011-03-15 02:23:35 +00:00
|
|
|
T:
|
2008-03-18 03:45:45 +00:00
|
|
|
store i1 %C, i1* %BP
|
|
|
|
unreachable
|
2011-03-15 02:23:35 +00:00
|
|
|
F:
|
2008-03-18 03:45:45 +00:00
|
|
|
ret void
|
2004-10-18 04:06:41 +00:00
|
|
|
}
|
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define void @test2() {
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test2(
|
2011-03-15 02:23:35 +00:00
|
|
|
; CHECK: entry:
|
|
|
|
; CHECK-NEXT: call void @test2()
|
|
|
|
; CHECK-NEXT: ret void
|
|
|
|
entry:
|
2008-03-18 03:45:45 +00:00
|
|
|
invoke void @test2( )
|
|
|
|
to label %N unwind label %U
|
2011-03-15 02:23:35 +00:00
|
|
|
U:
|
2008-03-18 03:45:45 +00:00
|
|
|
unreachable
|
2011-03-15 02:23:35 +00:00
|
|
|
N:
|
2008-03-18 03:45:45 +00:00
|
|
|
ret void
|
2004-10-18 04:06:41 +00:00
|
|
|
}
|
|
|
|
|
2008-03-18 03:45:45 +00:00
|
|
|
define i32 @test3(i32 %v) {
|
2013-07-14 01:42:54 +00:00
|
|
|
; CHECK-LABEL: @test3(
|
2011-03-15 02:23:35 +00:00
|
|
|
; CHECK: entry:
|
|
|
|
; CHECK-NEXT: [[CMP:%[A-Za-z0-9]+]] = icmp eq i32 %v, 2
|
|
|
|
; CHECK-NEXT: select i1 [[CMP]], i32 2, i32 1
|
|
|
|
; CHECK-NEXT: ret
|
|
|
|
entry:
|
2008-03-18 03:45:45 +00:00
|
|
|
switch i32 %v, label %default [
|
|
|
|
i32 1, label %U
|
|
|
|
i32 2, label %T
|
|
|
|
]
|
2011-03-15 02:23:35 +00:00
|
|
|
default:
|
2008-03-18 03:45:45 +00:00
|
|
|
ret i32 1
|
2011-03-15 02:23:35 +00:00
|
|
|
U:
|
2008-03-18 03:45:45 +00:00
|
|
|
unreachable
|
2011-03-15 02:23:35 +00:00
|
|
|
T:
|
2008-03-18 03:45:45 +00:00
|
|
|
ret i32 2
|
2004-10-18 04:06:41 +00:00
|
|
|
}
|
2008-03-18 03:45:45 +00:00
|
|
|
|
2011-03-15 02:23:35 +00:00
|
|
|
; PR9450
|
|
|
|
define i32 @test4(i32 %v) {
|
|
|
|
; CHECK: entry:
|
|
|
|
; CHECK-NEXT: switch i32 %v, label %T [
|
|
|
|
; CHECK-NEXT: i32 3, label %V
|
|
|
|
; CHECK-NEXT: i32 2, label %U
|
|
|
|
; CHECK-NEXT: ]
|
|
|
|
|
|
|
|
entry:
|
|
|
|
br label %SWITCH
|
|
|
|
V:
|
|
|
|
ret i32 7
|
|
|
|
SWITCH:
|
|
|
|
switch i32 %v, label %default [
|
|
|
|
i32 1, label %T
|
|
|
|
i32 2, label %U
|
|
|
|
i32 3, label %V
|
|
|
|
]
|
|
|
|
default:
|
|
|
|
unreachable
|
|
|
|
U:
|
|
|
|
ret i32 1
|
|
|
|
T:
|
|
|
|
ret i32 2
|
|
|
|
}
|