1 ; RUN: llc -sehprepare < %s | FileCheck %s
3 ; Test case based on this code:
4 ; extern "C" unsigned long _exception_code();
5 ; extern "C" int filt(unsigned long);
7 ; extern "C" void do_except() {
10 ; } __except(filt(_exception_code())) {
14 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
15 target triple = "x86_64-pc-windows-msvc"
17 ; Function Attrs: uwtable
18 define void @do_except() #0 {
20 call void (...) @llvm.frameescape()
22 to label %__try.cont unwind label %lpad1
24 lpad1: ; preds = %entry
25 %ehvals = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__C_specific_handler to i8*)
26 catch i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@do_except@@" to i8*)
27 %recover = call i8* (...) @llvm.eh.actions(i32 1, i8* bitcast (i32 (i8*, i8*)* @"\01?filt$0@0@do_except@@" to i8*), i32 -1, i8* blockaddress(@do_except, %__try.cont))
28 indirectbr i8* %recover, [label %__try.cont]
30 __try.cont: ; preds = %lpad1, %entry
34 ; CHECK-LABEL: do_except:
35 ; CHECK: .seh_handler __C_specific_handler
37 ; CHECK: .seh_handlerdata
39 ; CHECK-NEXT: .long .Ltmp{{.*}}
40 ; CHECK-NEXT: .long .Ltmp{{.*}}
41 ; CHECK-NEXT: .long "?filt$0@0@do_except@@"@IMGREL
42 ; CHECK-NEXT: .long .Ltmp{{.*}}@IMGREL
44 ; Function Attrs: noinline nounwind
45 define internal i32 @"\01?filt$0@0@do_except@@"(i8* nocapture readonly %exception_pointers, i8* nocapture readnone %frame_pointer) #1 {
47 %0 = bitcast i8* %exception_pointers to i32**
48 %1 = load i32*, i32** %0, align 8
49 %2 = load i32, i32* %1, align 4
50 %call = tail call i32 @filt(i32 %2) #4
54 declare i32 @filt(i32) #2
58 declare i32 @__C_specific_handler(...)
60 ; Function Attrs: nounwind readnone
61 declare i32 @llvm.eh.typeid.for(i8*) #3
63 ; Function Attrs: nounwind
64 declare i8* @llvm.eh.actions(...) #4
66 ; Function Attrs: nounwind
67 declare void @llvm.frameescape(...) #4
69 ; Function Attrs: nounwind readnone
70 declare i8* @llvm.framerecover(i8*, i8*, i32) #3
72 attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" "wineh-parent"="do_except" }
73 attributes #1 = { noinline nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
74 attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "unsafe-fp-math"="false" "use-soft-float"="false" }
75 attributes #3 = { nounwind readnone }
76 attributes #4 = { nounwind }
77 attributes #5 = { noinline }
79 !llvm.module.flags = !{!0}
82 !0 = !{i32 1, !"PIC Level", i32 2}
83 !1 = !{!"clang version 3.7.0 "}