Fix another instance where PHI nodes need special treatment.
authorOwen Anderson <resistor@mac.com>
Tue, 13 Jun 2006 20:50:09 +0000 (20:50 +0000)
committerOwen Anderson <resistor@mac.com>
Tue, 13 Jun 2006 20:50:09 +0000 (20:50 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28774 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/LCSSA.cpp

index 37ab7ee7ff2c6b3ff8df1a40e3b48c2fe77f8fef..3c70f735e88c03f1c8e0b67dfd41aeb55ecc0b59 100644 (file)
@@ -215,6 +215,12 @@ void LCSSA::processInstruction(Instruction* Instr,
   for (Instruction::use_iterator UI = Instr->use_begin(), UE = Instr->use_end();
        UI != UE; ++UI) {
     Instruction* use = cast<Instruction>(*UI);
+    BasicBlock* UserBB = use->getParent();
+    if (PHINode* p = dyn_cast<PHINode>(use)) {
+      unsigned OperandNo = UI.getOperandNo();
+      UserBB = p->getIncomingBlock(OperandNo/2);
+    }
+    
     // Don't need to update uses within the loop body.
     if (!inLoop(use->getParent()))
       Uses.push_back(use);