1 ; RUN: opt -mtriple=x86_64-pc-windows-msvc -winehprepare -S -o - < %s | FileCheck %s
3 ; This test is based on the following code:
14 ; Parts of the IR have been hand-edited to simplify the test case.
15 ; The full IR will be restored when Windows C++ EH support is complete.
17 ; ModuleID = 'catch-all.cpp'
18 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
19 target triple = "x86_64-pc-windows-msvc"
21 ; Function Attrs: uwtable
22 define void @_Z4testv() #0 {
24 %exn.slot = alloca i8*
25 %ehselector.slot = alloca i32
26 invoke void @_Z9may_throwv()
27 to label %invoke.cont unwind label %lpad
29 invoke.cont: ; preds = %entry
32 lpad: ; preds = %entry
33 %tmp = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
35 %tmp1 = extractvalue { i8*, i32 } %tmp, 0
36 store i8* %tmp1, i8** %exn.slot
37 %tmp2 = extractvalue { i8*, i32 } %tmp, 1
38 store i32 %tmp2, i32* %ehselector.slot
41 catch: ; preds = %lpad
42 %exn = load i8*, i8** %exn.slot
43 call void @llvm.eh.begincatch(i8* %exn, i8* null) #2
44 call void @_Z16handle_exceptionv()
45 br label %invoke.cont2
47 invoke.cont2: ; preds = %catch
48 call void @llvm.eh.endcatch()
51 try.cont: ; preds = %invoke.cont2, %invoke.cont
55 ; CHECK: define internal i8* @_Z4testv.catch(i8*, i8*) {
57 ; CHECK: call void @_Z16handle_exceptionv()
58 ; CHECK: ret i8* blockaddress(@_Z4testv, %try.cont)
61 declare void @_Z9may_throwv() #1
63 declare i32 @__CxxFrameHandler3(...)
65 declare void @llvm.eh.begincatch(i8*, i8*)
67 declare void @_Z16handle_exceptionv() #1
69 declare void @llvm.eh.endcatch()
71 attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
72 attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
73 attributes #2 = { noinline noreturn nounwind }
74 attributes #3 = { nounwind }
75 attributes #4 = { noreturn nounwind }
79 !0 = !{!"clang version 3.7.0 (trunk 226027)"}