1 ; RUN: opt -mtriple=x86_64-pc-windows-msvc -winehprepare -S -o - < %s | FileCheck %s
3 ; This test is based on the following source, built with -O2
17 ; ModuleID = '<stdin>'
18 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
19 target triple = "x86_64-pc-windows-msvc"
21 %rtti.TypeDescriptor2 = type { i8**, i8*, [3 x i8] }
22 %eh.CatchHandlerType = type { i32, i8* }
23 %eh.ThrowInfo = type { i32, i32, i32, i32 }
25 $"\01??_R0H@8" = comdat any
27 @"\01??_7type_info@@6B@" = external constant i8*
28 @"\01??_R0H@8" = linkonce_odr global %rtti.TypeDescriptor2 { i8** @"\01??_7type_info@@6B@", i8* null, [3 x i8] c".H\00" }, comdat
29 @llvm.eh.handlertype.H.0 = private unnamed_addr constant %eh.CatchHandlerType { i32 0, i8* bitcast (%rtti.TypeDescriptor2* @"\01??_R0H@8" to i8*) }, section "llvm.metadata"
31 ; CHECK-LABEL: define void @"\01?f@@YAXXZ"()
33 ; CHECK: call void (...) @llvm.frameescape()
34 ; CHECK: invoke void @"\01?g@@YAXXZ"()
36 ; Function Attrs: nounwind
37 define void @"\01?f@@YAXXZ"() #0 personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) {
39 invoke void @"\01?g@@YAXXZ"()
40 to label %invoke.cont unwind label %lpad
42 ; CHECK-LABEL: invoke.cont:
43 ; CHECK: invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null)
44 ; CHECK: to label %unreachable unwind label %[[LPAD1_LABEL:lpad[0-9]+]]
46 invoke.cont: ; preds = %entry
47 invoke void @_CxxThrowException(i8* null, %eh.ThrowInfo* null) #4
48 to label %unreachable unwind label %lpad1
50 lpad: ; preds = %entry
51 %0 = landingpad { i8*, i32 }
53 %1 = extractvalue { i8*, i32 } %0, 0
56 ; Note: Even though this landing pad has two catch clauses, it only has one action because both
57 ; handlers do the same thing.
58 ; CHECK: [[LPAD1_LABEL]]:
59 ; CHECK: landingpad { i8*, i32 }
60 ; CHECK-NEXT: catch %eh.CatchHandlerType* @llvm.eh.handlertype.H.0
61 ; CHECK-NEXT: catch i8* null
62 ; CHECK-NEXT: [[RECOVER:\%.+]] = call i8* (...) @llvm.eh.actions(i32 1, i8* null, i32 -1, i8* (i8*, i8*)* @"\01?f@@YAXXZ.catch")
63 ; CHECK-NEXT: indirectbr i8* [[RECOVER]], [label %try.cont4]
65 lpad1: ; preds = %invoke.cont
66 %2 = landingpad { i8*, i32 }
67 catch %eh.CatchHandlerType* @llvm.eh.handlertype.H.0
69 %3 = extractvalue { i8*, i32 } %2, 0
72 catch2: ; preds = %lpad1, %lpad
73 %exn.slot.0 = phi i8* [ %3, %lpad1 ], [ %1, %lpad ]
74 tail call void @llvm.eh.begincatch(i8* %exn.slot.0, i8* null) #3
75 tail call void @llvm.eh.endcatch() #3
78 try.cont4: ; preds = %catch, %catch2
81 unreachable: ; preds = %invoke.cont
87 declare void @"\01?g@@YAXXZ"() #1
89 declare i32 @__CxxFrameHandler3(...)
91 declare void @_CxxThrowException(i8*, %eh.ThrowInfo*)
93 ; Function Attrs: nounwind readnone
94 declare i32 @llvm.eh.typeid.for(i8*) #2
96 ; Function Attrs: nounwind
97 declare void @llvm.eh.begincatch(i8* nocapture, i8* nocapture) #3
99 ; Function Attrs: nounwind
100 declare void @llvm.eh.endcatch() #3
102 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
103 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
104 attributes #2 = { nounwind readnone }
105 attributes #3 = { nounwind }
106 attributes #4 = { noreturn }
110 !0 = !{!"clang version 3.7.0 (trunk 235112) (llvm/trunk 235121)"}