Extended support for native Windows C++ EH outlining
Differential Review: http://reviews.llvm.org/D7886
llvm-svn: 231981
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 00c3e06..7053283 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -392,6 +392,14 @@
// terminator into the new basic block in this case.
if (Action == CloningDirector::StopCloningBB)
return;
+ 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();
+ for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i)
+ ToClone.push_back(TI->getSuccessor(i));
+ return;
+ }
assert(Action != CloningDirector::SkipInstruction &&
"SkipInstruction is not valid for terminators.");
}