diff options
author | Reid Kleckner <reid@kleckner.net> | 2015-04-10 16:26:42 +0000 |
---|---|---|
committer | Reid Kleckner <reid@kleckner.net> | 2015-04-10 16:26:42 +0000 |
commit | 6e48a826e88bc5dbf4ae1b09e8e25812f818e62c (patch) | |
tree | 4a9a04ad0b04904a37b0a8918ebca6e32f5cfff9 /llvm/lib | |
parent | 42b33806bfb744e24f0a90dacba621d8a042a5fa (diff) | |
download | bcm5719-llvm-6e48a826e88bc5dbf4ae1b09e8e25812f818e62c.tar.gz bcm5719-llvm-6e48a826e88bc5dbf4ae1b09e8e25812f818e62c.zip |
[WinEH] Try to make outlining invokes work a little better
WinEH currently turns invokes into calls. Long term, we will reconsider
this, but for now, make sure we remap the operands and clone the
successors of the new terminator.
llvm-svn: 234608
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/WinEHPrepare.cpp | 5 | ||||
-rw-r--r-- | llvm/lib/Transforms/Utils/CloneFunction.cpp | 2 |
2 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index 02bb0826f47..b2945a1074c 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -1231,6 +1231,9 @@ CloningDirector::CloningAction WinEHCleanupDirector::handleInvoke( NewCall->setDebugLoc(Invoke->getDebugLoc()); VMap[Invoke] = NewCall; + // Remap the operands. + llvm::RemapInstruction(NewCall, VMap, RF_None, nullptr, &Materializer); + // Insert an unconditional branch to the normal destination. BranchInst::Create(Invoke->getNormalDest(), NewBB); @@ -1239,7 +1242,7 @@ CloningDirector::CloningAction WinEHCleanupDirector::handleInvoke( // We just added a terminator to the cloned block. // Tell the caller to stop processing the current basic block. - return CloningDirector::StopCloningBB; + return CloningDirector::CloneSuccessors; } CloningDirector::CloningAction WinEHCleanupDirector::handleResume( diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index ec95361b395..a376c3df744 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -395,7 +395,7 @@ void PruningFunctionCloner::CloneBlock(const BasicBlock *BB, if (Action == CloningDirector::CloneSuccessors) { // If the director says to skip with a terminate instruction, we still // need to clone this block's successors. - const TerminatorInst *TI = BB->getTerminator(); + const TerminatorInst *TI = NewBB->getTerminator(); for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) ToClone.push_back(TI->getSuccessor(i)); return; |