diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-16 14:41:14 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-16 14:41:14 +0000 |
commit | 250b754428110bedb864e74ae7c8c59619c662e8 (patch) | |
tree | eb0d153e81de265ded9881531313cb450ba0315f /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
parent | fb83b043ebce5b1492635998c9c89420fcef3592 (diff) | |
download | llvm-250b754428110bedb864e74ae7c8c59619c662e8.zip llvm-250b754428110bedb864e74ae7c8c59619c662e8.tar.gz llvm-250b754428110bedb864e74ae7c8c59619c662e8.tar.bz2 |
Instead, teach SimplifyCFG to trim non-address-taken blocks from
indirectbr destination lists.
llvm-svn: 111122
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index db719a0..28d7afb 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -2057,12 +2057,13 @@ bool SimplifyCFGOpt::run(BasicBlock *BB) { return true; } } - } else if (IndirectBrInst *IBI = dyn_cast<IndirectBrInst>(BB->getTerminator())) { + } else if (IndirectBrInst *IBI = + dyn_cast<IndirectBrInst>(BB->getTerminator())) { // Eliminate redundant destinations. SmallPtrSet<Value *, 8> Succs; for (unsigned i = 0, e = IBI->getNumDestinations(); i != e; ++i) { BasicBlock *Dest = IBI->getDestination(i); - if (!Succs.insert(Dest)) { + if (!Dest->hasAddressTaken() || !Succs.insert(Dest)) { Dest->removePredecessor(BB); IBI->removeDestination(i); --i; --e; |