summaryrefslogtreecommitdiff
path: root/lib/Transforms/Utils
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2011-08-09 01:17:10 +0000
committerBill Wendling <isanbard@gmail.com>2011-08-09 01:17:10 +0000
commit8d676c2199f21c5bd07aedd338dd3d228c502d5c (patch)
tree1d8bc646bc249bf8a680d19dcc5b6623edc4c027 /lib/Transforms/Utils
parent4fa93b7ce153a3834a7e189026e7451bcc19a34a (diff)
downloadllvm-8d676c2199f21c5bd07aedd338dd3d228c502d5c.tar.gz
llvm-8d676c2199f21c5bd07aedd338dd3d228c502d5c.tar.bz2
llvm-8d676c2199f21c5bd07aedd338dd3d228c502d5c.tar.xz
There is only one instance of this placeholder being created. Just use that
instead of a vector. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Utils')
-rw-r--r--lib/Transforms/Utils/LowerInvoke.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Transforms/Utils/LowerInvoke.cpp b/lib/Transforms/Utils/LowerInvoke.cpp
index 3a034ecd90..5040bb6878 100644
--- a/lib/Transforms/Utils/LowerInvoke.cpp
+++ b/lib/Transforms/Utils/LowerInvoke.cpp
@@ -406,7 +406,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
SmallVector<ReturnInst*,16> Returns;
SmallVector<UnwindInst*,16> Unwinds;
SmallVector<InvokeInst*,16> Invokes;
- SmallVector<UnreachableInst*, 16> Unreachables;
+ UnreachableInst* UnreachablePlaceholder = 0;
for (Function::iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
if (ReturnInst *RI = dyn_cast<ReturnInst>(BB->getTerminator())) {
@@ -490,7 +490,7 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
// for a standard call). We insert an unreachable instruction here and
// modify the block to jump to the correct unwinding pad later.
BasicBlock *UnwindBB = BasicBlock::Create(F.getContext(), "unwindbb", &F);
- Unreachables.push_back(new UnreachableInst(F.getContext(), UnwindBB));
+ UnreachablePlaceholder = new UnreachableInst(F.getContext(), UnwindBB);
Value *CatchLoad = new LoadInst(InvokeNum, "invoke.num", true, CatchBB);
SwitchInst *CatchSwitch =
@@ -579,10 +579,10 @@ bool LowerInvoke::insertExpensiveEHSupport(Function &F) {
Unwinds[i]->eraseFromParent();
}
- // Replace all inserted unreachables with a branch to the unwind handler.
- for (unsigned i = 0, e = Unreachables.size(); i != e; ++i) {
- BranchInst::Create(UnwindHandler, Unreachables[i]);
- Unreachables[i]->eraseFromParent();
+ // Replace the inserted unreachable with a branch to the unwind handler.
+ if (UnreachablePlaceholder) {
+ BranchInst::Create(UnwindHandler, UnreachablePlaceholder);
+ UnreachablePlaceholder->eraseFromParent();
}
// Finally, for any returns from this function, if this function contains an