1; RUN: opt -S -inline < %s | FileCheck %s 2target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 3target triple = "i686-pc-windows-msvc18.0.0" 4 5declare void @g(i32) 6 7define void @f() personality i32 (...)* @__CxxFrameHandler3 { 8entry: 9 invoke void @g(i32 0) 10 to label %invoke.cont unwind label %cs.bb 11 12invoke.cont: 13 ret void 14 15cs.bb: 16 %cs = catchswitch within none [label %cp.bb] unwind label %cleanup.bb 17 18cp.bb: 19 %cpouter1 = catchpad within %cs [i8* null, i32 0, i8* null] 20 call void @dtor() #1 [ "funclet"(token %cpouter1) ] 21 catchret from %cpouter1 to label %invoke.cont 22 23cleanup.bb: 24 %cpouter2 = cleanuppad within none [] 25 call void @g(i32 1) [ "funclet"(token %cpouter2) ] 26 cleanupret from %cpouter2 unwind to caller 27} 28 29declare i32 @__CxxFrameHandler3(...) 30 31; Function Attrs: nounwind 32define internal void @dtor() #1 personality i32 (...)* @__CxxFrameHandler3 { 33entry: 34 invoke void @g(i32 2) 35 to label %invoke.cont unwind label %ehcleanup1 36 37invoke.cont: 38 ret void 39 40ehcleanup1: 41 %cpinner1 = cleanuppad within none [] 42 invoke void @g(i32 3) [ "funclet" (token %cpinner1) ] 43 to label %done unwind label %ehcleanup2 44done: 45 unreachable 46 47ehcleanup2: 48 %cpinner2 = cleanuppad within %cpinner1 [] 49 call void @g(i32 4) [ "funclet" (token %cpinner2) ] 50 cleanupret from %cpinner2 unwind to caller 51} 52 53; CHECK-LABEL: define void @f( 54 55; CHECK: %[[cs:.*]] = catchswitch within none 56 57; CHECK: %[[cpouter1:.*]] = catchpad within %[[cs]] 58 59; CHECK: %[[cpinner1:.*]] = cleanuppad within %[[cpouter1]] 60 61; CHECK: %[[cpinner2:.*]] = cleanuppad within %[[cpinner1]] 62; CHECK-NEXT: call void @g(i32 4) #0 [ "funclet"(token %[[cpinner2]]) ] 63; CHECK-NEXT: unreachable 64 65attributes #1 = { nounwind } 66