1; RUN: opt -S -passes=always-inline -mtriple=x86_64-windows-msvc < %s | FileCheck %s 2 3; WinEH requires funclet tokens on nounwind intrinsics if they can lower to 4; regular function calls in the course of IR transformations. 5; 6; Test that the inliner propagates funclet tokens to such intrinsics when 7; inlining into EH funclets, i.e.: llvm.objc.storeStrong inherits the "funclet" 8; token from inlined_fn. 9 10define void @inlined_fn(ptr %ex) #1 { 11entry: 12 call void @llvm.objc.storeStrong(ptr %ex, ptr null) 13 ret void 14} 15 16define void @test_catch_with_inline() personality ptr @__CxxFrameHandler3 { 17entry: 18 %exn.slot = alloca ptr, align 8 19 %ex = alloca ptr, align 8 20 invoke void @opaque() to label %invoke.cont unwind label %catch.dispatch 21 22catch.dispatch: 23 %0 = catchswitch within none [label %catch] unwind to caller 24 25invoke.cont: 26 unreachable 27 28catch: 29 %1 = catchpad within %0 [ptr null, i32 64, ptr %exn.slot] 30 call void @inlined_fn(ptr %ex) [ "funclet"(token %1) ] 31 catchret from %1 to label %catchret.dest 32 33catchret.dest: 34 ret void 35} 36 37declare void @opaque() 38declare void @llvm.objc.storeStrong(ptr, ptr) #0 39declare i32 @__CxxFrameHandler3(...) 40 41attributes #0 = { nounwind } 42attributes #1 = { alwaysinline } 43 44; After inlining, llvm.objc.storeStrong inherited the "funclet" token: 45; 46; CHECK-LABEL: define void @test_catch_with_inline() 47; ... 48; CHECK: catch: 49; CHECK-NEXT: %1 = catchpad within %0 [ptr null, i32 64, ptr %exn.slot] 50; CHECK-NEXT: call void @llvm.objc.storeStrong(ptr %ex, ptr null) [ "funclet"(token %1) ] 51; CHECK-NEXT: catchret from %1 to label %catchret.dest 52