r230717 - Add another __leave test.
Nico Weber
nicolasweber at gmx.de
Thu Feb 26 17:58:08 PST 2015
Author: nico
Date: Thu Feb 26 19:58:08 2015
New Revision: 230717
URL: http://llvm.org/viewvc/llvm-project?rev=230717&view=rev
Log:
Add another __leave test.
Modified:
cfe/trunk/test/CodeGen/exceptions-seh-leave.c
Modified: cfe/trunk/test/CodeGen/exceptions-seh-leave.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-leave.c?rev=230717&r1=230716&r2=230717&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/exceptions-seh-leave.c (original)
+++ cfe/trunk/test/CodeGen/exceptions-seh-leave.c Thu Feb 26 19:58:08 2015
@@ -125,8 +125,6 @@ int __leave_with___finally() {
//////////////////////////////////////////////////////////////////////////////
// Mixed, nested cases.
-// FIXME: Test with outer __finally once PR22553 is fixed.
-
int nested___except___finally() {
int myres = 0;
__try {
@@ -237,3 +235,68 @@ int nested___except___except() {
// CHECK: [[tryleave]]
// CHECK-NEXT: br label %[[trycont4]]
+
+int nested___finally___except() {
+ int myres = 0;
+ __try {
+ __try {
+ g();
+ } __except (1) {
+ g();
+ __leave; // Refers to the outer __try, not the __except!
+ myres = 23;
+ return 0;
+ }
+
+ myres = 51;
+ } __finally {
+ }
+ return 1;
+}
+// The order of basic blocks in the below doesn't matter.
+// CHECK-LABEL: define i32 @nested___finally___except()
+
+// CHECK-LABEL: invoke void bitcast (void (...)* @g to void ()*)()
+// CHECK-NEXT: to label %[[g1_cont:.*]] unwind label %[[g1_lpad:.*]]
+
+// CHECK: [[g1_cont]]
+// CHECK-NEXT: br label %[[trycont:[^ ]*]]
+
+// CHECK: [[g1_lpad]]
+// CHECK: br label %[[except]]
+
+// CHECK: [[except]]
+// CHECK-NEXT: invoke void bitcast (void (...)* @g to void ()*)()
+// CHECK-NEXT: to label %[[g2_cont:.*]] unwind label %[[g2_lpad:.*]]
+
+// CHECK: [[g2_cont]]
+// CHECK-NEXT: br label %[[tryleave:[^ ]*]]
+// CHECK-NOT: 23
+
+// CHECK: [[g2_lpad]]
+// CHECK: store i8 1, i8* %[[abnormal:[^ ]*]]
+// CHECK-NEXT: br label %[[finally:[^ ]*]]
+
+// CHECK: [[trycont]]
+// CHECK: store i32 51, i32* %
+// CHECK-NEXT: br label %[[tryleave]]
+
+// CHECK: [[tryleave]]
+// CHECK-NEXT: store i8 0, i8* %[[abnormal]]
+// CHECK-NEXT: br label %[[finally:[^ ]*]]
+
+// CHECK: [[finally]]
+// CHECK-NEXT: %[[abnormallocal:[^ ]*]] = load i8* %[[abnormal]]
+// CHECK-NEXT: %[[reg:[^ ]*]] = icmp eq i8 %[[abnormallocal]], 0
+// CHECK-NEXT: br i1 %[[reg]], label %[[finallycont:[^ ]*]], label %[[finallyresume:[^ ]*]]
+
+// CHECK: [[finallycont]]
+// CHECK-NEXT: ret i32 1
+
+// CHECK: [[finallyresume]]
+// CHECK-NEXT: br label %[[ehresume:[^ ]*]]
+
+// CHECK: [[ehresume]]
+// CHECK: resume
+
+// FIXME: Test with nested __finally blocks.
More information about the cfe-commits
mailing list