1 ; RUN: opt -S -simplifycfg < %s | FileCheck %s
3 declare void @Personality()
6 ; CHECK-LABEL: define void @test1()
7 define void @test1() personality i8* bitcast (void ()* @Personality to i8*) {
9 ; CHECK: call void @f()
11 to label %exit unwind label %unreachable.unwind
19 ; CHECK-LABEL: define void @test2()
20 define void @test2() personality i8* bitcast (void ()* @Personality to i8*) {
23 to label %exit unwind label %catch.pad
26 ; CHECK-NEXT: to label %catch.body unwind label %catch.end
28 to label %catch.body unwind label %catch.end
31 ; CHECK-NEXT: call void @f()
32 ; CHECK-NEXT: unreachable
34 catchret %catch to label %unreachable
37 ; CHECK-NEXT: catchendpad unwind to caller
38 catchendpad unwind label %unreachable.unwind
48 ; CHECK-LABEL: define void @test3()
49 define void @test3() personality i8* bitcast (void ()* @Personality to i8*) {
52 to label %exit unwind label %cleanup.pad
54 ; CHECK: %cleanup = cleanuppad []
55 ; CHECK-NEXT: call void @f()
56 ; CHECK-NEXT: unreachable
57 %cleanup = cleanuppad []
59 to label %cleanup.ret unwind label %cleanup.end
61 ; This cleanupret should be rewritten to unreachable,
62 ; and merged into the pred block.
63 cleanupret %cleanup unwind label %unreachable.unwind
65 ; This cleanupendpad should be rewritten to unreachable,
66 ; causing the invoke to be rewritten to a call.
67 cleanupendpad %cleanup unwind label %unreachable.unwind
75 ; CHECK-LABEL: define void @test4()
76 define void @test4() personality i8* bitcast (void ()* @Personality to i8*) {
79 to label %exit unwind label %terminate.pad
81 ; CHECK: terminatepad [] unwind to caller
82 terminatepad [] unwind label %unreachable.unwind
90 ; CHECK-LABEL: define void @test5()
91 define void @test5() personality i8* bitcast (void ()* @Personality to i8*) {
94 to label %exit unwind label %catch.pad
98 to label %catch.body unwind label %catch.end
101 catchret %catch to label %exit
104 catchendpad unwind to caller