summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Kaylor <andrew.kaylor@intel.com>2015-04-23 00:20:44 +0000
committerAndrew Kaylor <andrew.kaylor@intel.com>2015-04-23 00:20:44 +0000
commita1df0a312001ac1a9951c8925d7639442304a6e1 (patch)
tree80e48256cf3a7b1b436c815acec4fc57734adcff
parent395f4f4b2a3db77755fb0a08669b268e74f458c1 (diff)
[WinEH] Don't skip landing pads that end with an unreachable instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235563 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/CodeGen/WinEHPrepare.cpp10
-rw-r--r--test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll1
-rw-r--r--test/CodeGen/WinEH/cppeh-prepared-catch.ll1
3 files changed, 6 insertions, 6 deletions
diff --git a/lib/CodeGen/WinEHPrepare.cpp b/lib/CodeGen/WinEHPrepare.cpp
index 67f7cdc8fa..e11da29fed 100644
--- a/lib/CodeGen/WinEHPrepare.cpp
+++ b/lib/CodeGen/WinEHPrepare.cpp
@@ -637,12 +637,6 @@ bool WinEHPrepare::prepareExceptionHandlers(
LPadHasActionList = true;
break;
}
- // FIXME: This is here to help with the development of nested landing pad
- // outlining. It should be removed when that is finished.
- if (isa<UnreachableInst>(Inst)) {
- LPadHasActionList = true;
- break;
- }
}
// If we've already outlined the handlers for this landingpad,
@@ -1011,6 +1005,10 @@ static BasicBlock *createStubLandingPad(Function *Handler,
llvm::StructType::get(Type::getInt8PtrTy(Context),
Type::getInt32Ty(Context), nullptr),
PersonalityFn, 0);
+ // Insert a call to llvm.eh.actions so that we don't try to outline this lpad.
+ Function *ActionIntrin = Intrinsic::getDeclaration(Handler->getParent(),
+ Intrinsic::eh_actions);
+ Builder.CreateCall(ActionIntrin, "recover");
LPad->setCleanup(true);
Builder.CreateUnreachable();
return StubBB;
diff --git a/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll b/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll
index 4946c6affc..5c8170b0d4 100644
--- a/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll
+++ b/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll
@@ -106,6 +106,7 @@ entry.split: ; preds = %entry
stub: ; preds = %entry
%4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
cleanup
+ %recover = call i8* (...) @llvm.eh.actions()
unreachable
}
diff --git a/test/CodeGen/WinEH/cppeh-prepared-catch.ll b/test/CodeGen/WinEH/cppeh-prepared-catch.ll
index 98b4afcd05..8e8fc76818 100644
--- a/test/CodeGen/WinEH/cppeh-prepared-catch.ll
+++ b/test/CodeGen/WinEH/cppeh-prepared-catch.ll
@@ -70,6 +70,7 @@ done:
lpad: ; preds = %entry
%4 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*)
cleanup
+ %recover = call i8* (...) @llvm.eh.actions()
unreachable
}