1 ; RUN: opt -S -passes=always-inline -mtriple=x86_64-windows-msvc < %s | FileCheck %s
3 ; WinEH requires funclet tokens on nounwind intrinsics if they can lower to
4 ; regular function calls in the course of IR transformations.
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.
10 define void @inlined_fn(ptr %ex) #1 {
12 call void @llvm.objc.storeStrong(ptr %ex, ptr null)
16 define void @test_catch_with_inline() personality ptr @__CxxFrameHandler3 {
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
23 %0 = catchswitch within none [label %catch] unwind to caller
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
37 declare void @opaque()
38 declare void @llvm.objc.storeStrong(ptr, ptr) #0
39 declare i32 @__CxxFrameHandler3(...)
41 attributes #0 = { nounwind }
42 attributes #1 = { alwaysinline }
44 ; After inlining, llvm.objc.storeStrong inherited the "funclet" token:
46 ; CHECK-LABEL: define void @test_catch_with_inline()
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