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() personality i32 (...)* @__gxx_personality_v0 { 8; CHECK-LABEL: @test1( 9; CHECK-NEXT: call void @bar() 10; CHECK-NEXT: ret i32 0 11 invoke void @bar( ) 12 to label %1 unwind label %Rethrow 13 ret i32 0 14Rethrow: 15 %exn = landingpad {i8*, i32} 16 catch i8* null 17 resume { i8*, i32 } %exn 18} 19 20declare i64 @dummy1() 21declare i64 @dummy2() 22 23; This testcase checks to see if simplifycfg pass can convert two invoke 24; instructions to call instructions if they share a common trivial unwind 25; block. 26define i64 @test2(i1 %cond) personality i32 (...)* @__gxx_personality_v0 { 27entry: 28; CHECK-LABEL: @test2( 29; CHECK: %call1 = call i64 @dummy1() 30; CHECK: %call2 = call i64 @dummy2() 31; CHECK-NOT: resume { i8*, i32 } %lp 32 br i1 %cond, label %br1, label %br2 33 34br1: 35 %call1 = invoke i64 @dummy1() 36 to label %invoke.cont unwind label %lpad1 37 38br2: 39 %call2 = invoke i64 @dummy2() 40 to label %invoke.cont unwind label %lpad2 41 42invoke.cont: 43 %c = phi i64 [%call1, %br1], [%call2, %br2] 44 ret i64 %c 45 46 47lpad1: 48 %0 = landingpad { i8*, i32 } 49 cleanup 50 br label %rethrow 51 52lpad2: 53 %1 = landingpad { i8*, i32 } 54 cleanup 55 br label %rethrow 56 57rethrow: 58 %lp = phi { i8*, i32 } [%0, %lpad1], [%1, %lpad2] 59 resume { i8*, i32 } %lp 60} 61 62declare i32 @__gxx_personality_v0(...) 63