aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms/IPO
diff options
context:
space:
mode:
authorGabor Greif <ggreif@gmail.com>2009-01-23 19:40:15 +0000
committerGabor Greif <ggreif@gmail.com>2009-01-23 19:40:15 +0000
commita36791da41cf4f635e50077b290676b873836bda (patch)
tree93f751d2adbba6056d4f2e16b04288a5864f238d /lib/Transforms/IPO
parent60789e419e04c260e36af9a1add5ad316313e490 (diff)
Simplify the logic of getting hold of a PHI predecessor block.
There is now a direct way from value-use-iterator to incoming block in PHINode's API. This way we avoid the iterator->index->iterator trip, and especially the costly getOperandNo() invocation. Additionally there is now an assertion that the iterator really refers to one of the PHI's Uses. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index 99fc7317b1..7f636c9270 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -988,8 +988,7 @@ static void ReplaceUsesOfMallocWithGlobal(Instruction *Alloc,
} else if (PHINode *PN = dyn_cast<PHINode>(U)) {
// Insert the load in the corresponding predecessor, not right before the
// PHI.
- unsigned PredNo = Alloc->use_begin().getOperandNo()/2;
- InsertPt = PN->getIncomingBlock(PredNo)->getTerminator();
+ InsertPt = PN->getIncomingBlock(Alloc->use_begin())->getTerminator();
} else if (isa<BitCastInst>(U)) {
// Must be bitcast between the malloc and store to initialize the global.
ReplaceUsesOfMallocWithGlobal(U, GV);