1 ; RUN: opt -lowerinvoke -S < %s | FileCheck %s 2 3 ; Test if invoke instructions that have a funclet operand bundle can be lowered. 4 5 %struct.Cleanup = type { i8 } 6 7 define void @lowerinvoke_funclet() personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { 8 ; CHECK-LABEL: @lowerinvoke_funclet 9 entry: 10 %c = alloca %struct.Cleanup, align 1 11 invoke void @foo() 12 to label %try.cont unwind label %catch.dispatch 13 14 catch.dispatch: ; preds = %entry 15 %0 = catchswitch within none [label %catch] unwind to caller 16 17 catch: ; preds = %catch.dispatch 18 %1 = catchpad within %0 [i8* null, i32 64, i8* null] 19 invoke void @bar(i32 3) [ "funclet"(token %1), "test"(i32 0) ] 20 to label %invoke.cont1 unwind label %ehcleanup 21 ; CHECK: call void @bar(i32 3) [ "funclet"(token %1), "test"(i32 0) ] 22 23 invoke.cont1: ; preds = %catch 24 call void @"??1Cleanup@@QEAA@XZ"(%struct.Cleanup* %c) #3 [ "funclet"(token %1) ] 25 catchret from %1 to label %try.cont 26 27 try.cont: ; preds = %entry, %invoke.cont1 28 ret void 29 30 ehcleanup: ; preds = %catch 31 %2 = cleanuppad within %1 [] 32 call void @"??1Cleanup@@QEAA@XZ"(%struct.Cleanup* %c) #3 [ "funclet"(token %2) ] 33 cleanupret from %2 unwind to caller 34 } 35 36 declare void @foo() 37 declare void @bar(i32) 38 declare i32 @__CxxFrameHandler3(...) 39 declare void @"??1Cleanup@@QEAA@XZ"(%struct.Cleanup*) unnamed_addr 40