1; RUN: opt < %s -simplifycfg -S | FileCheck %s
2
3declare void @bar()
4
5; This testcase checks to see if the simplifycfg pass is converting invoke
6; instructions to call instructions if the handler just rethrows the exception.
7define i32 @test1() {
8; CHECK: @test1
9; CHECK-NEXT: call void @bar()
10; CHECK-NEXT: ret i32 0
11        invoke void @bar( )
12                        to label %Ok unwind label %Rethrow
13Ok:             ; preds = %0
14        ret i32 0
15Rethrow:                ; preds = %0
16        unwind
17}
18
19
20; Verify that simplifycfg isn't duplicating 'unwind' instructions.  Doing this
21; is bad because it discourages commoning.
22define i32 @test2(i1 %c) {
23; CHECK: @test2
24; CHECK: T:
25; CHECK-NEXT: call void @bar()
26; CHECK-NEXT: br label %F
27  br i1 %c, label %T, label %F
28T:
29  call void @bar()
30  br label %F
31F:
32  unwind
33}
34