r263269 - [SEH] Remove nounwind/noinline from outlined finally funclets
Reid Kleckner via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 11 09:36:17 PST 2016
Author: rnk
Date: Fri Mar 11 11:36:16 2016
New Revision: 263269
URL: http://llvm.org/viewvc/llvm-project?rev=263269&view=rev
Log:
[SEH] Remove nounwind/noinline from outlined finally funclets
With the new EH representation this is no longer necessary.
Modified:
cfe/trunk/lib/CodeGen/CGException.cpp
cfe/trunk/test/CodeGen/exceptions-seh-finally.c
Modified: cfe/trunk/lib/CodeGen/CGException.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=263269&r1=263268&r2=263269&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGException.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGException.cpp Fri Mar 11 11:36:16 2016
@@ -1708,12 +1708,6 @@ CodeGenFunction::GenerateSEHFinallyFunct
const Stmt *FinallyBlock = Finally.getBlock();
startOutlinedSEHHelper(ParentCGF, false, FinallyBlock);
- // Mark finally block calls as nounwind and noinline to make LLVM's job a
- // little easier.
- // FIXME: Remove these restrictions in the future.
- CurFn->addFnAttr(llvm::Attribute::NoUnwind);
- CurFn->addFnAttr(llvm::Attribute::NoInline);
-
// Emit the original filter expression, convert to i32, and return.
EmitStmt(FinallyBlock);
Modified: cfe/trunk/test/CodeGen/exceptions-seh-finally.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exceptions-seh-finally.c?rev=263269&r1=263268&r2=263269&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/exceptions-seh-finally.c (original)
+++ cfe/trunk/test/CodeGen/exceptions-seh-finally.c Fri Mar 11 11:36:16 2016
@@ -29,6 +29,7 @@ void basic_finally(void) {
// CHECK-NEXT: cleanupret from %[[pad]] unwind to caller
// CHECK: define internal void @"\01?fin$0 at 0@basic_finally@@"({{.*}})
+// CHECK-SAME: [[finally_attrs:#[0-9]+]]
// CHECK: call void @cleanup()
// Mostly check that we don't double emit 'r' which would crash.
@@ -62,6 +63,7 @@ l:
// CHECK: ret void
// CHECK: define internal void @"\01?fin$0 at 0@label_in_finally@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: br label %[[l:[^ ]*]]
//
// CHECK: [[l]]
@@ -95,6 +97,7 @@ void use_abnormal_termination(void) {
// CHECK-NEXT: cleanupret from %[[pad]] unwind to caller
// CHECK: define internal void @"\01?fin$0 at 0@use_abnormal_termination@@"({{i8( zeroext)?}} %[[abnormal:abnormal_termination]], i8* %frame_pointer)
+// CHECK-SAME: [[finally_attrs]]
// CHECK: %[[abnormal_zext:[^ ]*]] = zext i8 %[[abnormal]] to i32
// CHECK: store i32 %[[abnormal_zext]], i32* @crashed
// CHECK-NEXT: ret void
@@ -112,6 +115,7 @@ void noreturn_noop_finally() {
// CHECK: ret void
// CHECK: define internal void @"\01?fin$0 at 0@noreturn_noop_finally@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: call void @abort()
// CHECK: unreachable
@@ -137,6 +141,7 @@ void noreturn_finally() {
// CHECK-NEXT: cleanupret from %[[pad]] unwind to caller
// CHECK: define internal void @"\01?fin$0 at 0@noreturn_finally@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: call void @abort()
// CHECK: unreachable
@@ -151,6 +156,7 @@ int finally_with_return() {
// CHECK-NEXT: ret i32 42
// CHECK: define internal void @"\01?fin$0 at 0@finally_with_return@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK-NOT: br i1
// CHECK-NOT: br label
// CHECK: ret void
@@ -181,9 +187,11 @@ int nested___finally___finally() {
// CHECK-NEXT: cleanupret from %[[pad]] unwind to caller
// CHECK-LABEL: define internal void @"\01?fin$0 at 0@nested___finally___finally@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: ret void
// CHECK-LABEL: define internal void @"\01?fin$1 at 0@nested___finally___finally@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: unreachable
// FIXME: Our behavior seems suspiciously different.
@@ -226,9 +234,11 @@ int nested___finally___finally_with_eh_e
// CHECK-NEXT: cleanupret from %[[outerpad]] unwind to caller
// CHECK-LABEL: define internal void @"\01?fin$0 at 0@nested___finally___finally_with_eh_edge@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: ret void
// CHECK-LABEL: define internal void @"\01?fin$1 at 0@nested___finally___finally_with_eh_edge@@"({{.*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: unreachable
void finally_within_finally() {
@@ -248,10 +258,17 @@ void finally_within_finally() {
// CHECK: call void @"\01?fin$0 at 0@finally_within_finally@@"(
// CHECK: call void @"\01?fin$0 at 0@finally_within_finally@@"({{.*}}) [ "funclet"(
-// CHECK-LABEL: define internal void @"\01?fin$0 at 0@finally_within_finally@@"(
+// CHECK-LABEL: define internal void @"\01?fin$0 at 0@finally_within_finally@@"({{[^)]*}})
+// CHECK-SAME: [[finally_attrs]]
// CHECK: invoke void @might_crash(
// CHECK: call void @"\01?fin$1 at 0@finally_within_finally@@"(
// CHECK: call void @"\01?fin$1 at 0@finally_within_finally@@"({{.*}}) [ "funclet"(
-// CHECK-LABEL: define internal void @"\01?fin$1 at 0@finally_within_finally@@"(
+// CHECK-LABEL: define internal void @"\01?fin$1 at 0@finally_within_finally@@"({{[^)]*}})
+// CHECK-SAME: [[finally_attrs]]
+
+// Look for the absence of noinline. Enum attributes come first, so check that
+// a string attribute is the first to verify that no enum attributes are
+// present.
+// CHECK: attributes [[finally_attrs]] = { "{{.*}}" }
More information about the cfe-commits
mailing list