summaryrefslogtreecommitdiffstats
path: root/clang/test/CodeGen
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2015-10-07 01:07:13 +0000
committerReid Kleckner <rnk@google.com>2015-10-07 01:07:13 +0000
commitf8d115338d1ec2ea14a072b65647816b02b9d30b (patch)
treea3cc258663cf122f2e5caa7bd18297213bdc491f /clang/test/CodeGen
parent52dca345db0ded0d934a312b6a103a08c8ffc997 (diff)
downloadbcm5719-llvm-f8d115338d1ec2ea14a072b65647816b02b9d30b.tar.gz
bcm5719-llvm-f8d115338d1ec2ea14a072b65647816b02b9d30b.zip
[SEH] Fix x64 __exception_code in __except blocks
Use llvm.eh.exceptioncode to get the code out of EAX for x64. For 32-bit, the filter is responsible for storing it to memory for us. llvm-svn: 249497
Diffstat (limited to 'clang/test/CodeGen')
-rw-r--r--clang/test/CodeGen/exceptions-seh-new.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGen/exceptions-seh-new.c b/clang/test/CodeGen/exceptions-seh-new.c
index 795277bd9b4..1a50ed0deae 100644
--- a/clang/test/CodeGen/exceptions-seh-new.c
+++ b/clang/test/CodeGen/exceptions-seh-new.c
@@ -265,4 +265,25 @@ void finally_capture_twice(int x) {
// CHECK-NEXT: store i32 [[T0]], i32* [[Z]], align 4
// CHECK-NEXT: ret void
+int exception_code_in_except(void) {
+ __try {
+ try_body(0, 0, 0);
+ } __except(1) {
+ return _exception_code();
+ }
+}
+
+// CHECK-LABEL: define i32 @exception_code_in_except()
+// CHECK: %[[ret_slot:[^ ]*]] = alloca i32
+// CHECK: %[[code_slot:[^ ]*]] = alloca i32
+// CHECK: invoke void @try_body(i32 0, i32 0, i32* null)
+// CHECK: %[[pad:[^ ]*]] = catchpad
+// CHECK: catchret %[[pad]]
+// X64: %[[code:[^ ]*]] = call i32 @llvm.eh.exceptioncode(token %[[pad]])
+// X64: store i32 %[[code]], i32* %[[code_slot]]
+// CHECK: %[[ret1:[^ ]*]] = load i32, i32* %[[code_slot]]
+// CHECK: store i32 %[[ret1]], i32* %[[ret_slot]]
+// CHECK: %[[ret2:[^ ]*]] = load i32, i32* %[[ret_slot]]
+// CHECK: ret i32 %[[ret2]]
+
// CHECK: attributes #[[NOINLINE]] = { {{.*noinline.*}} }
OpenPOWER on IntegriCloud