From eb61fcf2a1f949b70264c6a86ea7559f7ac3ed76 Mon Sep 17 00:00:00 2001 From: Gabor Greif Date: Fri, 23 Jan 2009 19:40:15 +0000 Subject: 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. llvm-svn: 62869 --- llvm/lib/Transforms/Utils/LCSSA.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'llvm/lib/Transforms/Utils/LCSSA.cpp') diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp index 38558886115..9cd7e69557a 100644 --- a/llvm/lib/Transforms/Utils/LCSSA.cpp +++ b/llvm/lib/Transforms/Utils/LCSSA.cpp @@ -175,8 +175,7 @@ void LCSSA::ProcessInstruction(Instruction *Instr, UI != E;) { BasicBlock *UserBB = cast(*UI)->getParent(); if (PHINode *P = dyn_cast(*UI)) { - unsigned OperandNo = UI.getOperandNo(); - UserBB = P->getIncomingBlock(OperandNo/2); + UserBB = P->getIncomingBlock(UI); } // If the user is in the loop, don't rewrite it! @@ -212,8 +211,7 @@ void LCSSA::getLoopValuesUsedOutsideLoop(Loop *L, ++UI) { BasicBlock *UserBB = cast(*UI)->getParent(); if (PHINode* p = dyn_cast(*UI)) { - unsigned OperandNo = UI.getOperandNo(); - UserBB = p->getIncomingBlock(OperandNo/2); + UserBB = p->getIncomingBlock(UI); } if (*BB != UserBB && !inLoop(UserBB)) { -- cgit v1.2.3