summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/ADCE.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-12-12 22:44:30 +0000
committerChris Lattner <sabre@nondot.org>2004-12-12 22:44:30 +0000
commit9115eb302457038788e9bbe1280b2fe31227b747 (patch)
tree0a095dd5b19130800c42a7f0c7eb9e0a3fa7c1b2 /llvm/lib/Transforms/Scalar/ADCE.cpp
parentd4298781c12979df061bcdd689d5222ef4c965e4 (diff)
downloadbcm5719-llvm-9115eb302457038788e9bbe1280b2fe31227b747.tar.gz
bcm5719-llvm-9115eb302457038788e9bbe1280b2fe31227b747.zip
More minor microoptimizations
llvm-svn: 18841
Diffstat (limited to 'llvm/lib/Transforms/Scalar/ADCE.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/ADCE.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index fde1308aba2..43471341f4c 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -264,8 +264,6 @@ bool ADCE::doADCE() {
for (pred_iterator PI = pred_begin(I), E = pred_end(I); PI != E; ++PI)
markInstructionLive((*PI)->getTerminator());
-
-
DEBUG(std::cerr << "Processing work list\n");
// AliveBlocks - Set of basic blocks that we know have instructions that are
@@ -291,12 +289,12 @@ bool ADCE::doADCE() {
// makes the predecessors alive.
//
if (PHINode *PN = dyn_cast<PHINode>(I))
- for (pred_iterator PI = pred_begin(BB), PE = pred_end(BB); PI != PE; ++PI)
- if (AliveBlocks.insert(*PI).second) // Block is now ALIVE!
- markBlockAlive(*PI);
+ for (unsigned i = 0, e = PN->getNumIncomingValues(); i != e; ++i)
+ if (AliveBlocks.insert(PN->getIncomingBlock(i)).second)
+ markBlockAlive(PN->getIncomingBlock(i)); // Block is newly ALIVE!
// Loop over all of the operands of the live instruction, making sure that
- // they are known to be alive as well...
+ // they are known to be alive as well.
//
for (unsigned op = 0, End = I->getNumOperands(); op != End; ++op)
if (Instruction *Operand = dyn_cast<Instruction>(I->getOperand(op)))
OpenPOWER on IntegriCloud