From: Andrew Kaylor Date: Thu, 23 Apr 2015 00:20:44 +0000 (+0000) Subject: [WinEH] Don't skip landing pads that end with an unreachable instruction. X-Git-Tag: llvmorg-3.7.0-rc1~6204 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=43e1d7627897c1efb45a61477f92b4298db7015b;p=platform%2Fupstream%2Fllvm.git [WinEH] Don't skip landing pads that end with an unreachable instruction. llvm-svn: 235563 --- diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 67f7cdc..e11da29 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/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(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/llvm/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll b/llvm/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll index 4946c6a..5c8170b 100644 --- a/llvm/test/CodeGen/WinEH/cppeh-prepared-catch-reordered.ll +++ b/llvm/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/llvm/test/CodeGen/WinEH/cppeh-prepared-catch.ll b/llvm/test/CodeGen/WinEH/cppeh-prepared-catch.ll index 98b4afc..8e8fc76 100644 --- a/llvm/test/CodeGen/WinEH/cppeh-prepared-catch.ll +++ b/llvm/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 }