[llvm-commits] [llvm] r90909 - /llvm/trunk/lib/Analysis/PHITransAddr.cpp

Chris Lattner sabre at nondot.org
Tue Dec 8 16:18:13 PST 2009


Author: lattner
Date: Tue Dec  8 18:18:13 2009
New Revision: 90909

URL: http://llvm.org/viewvc/llvm-project?rev=90909&view=rev
Log:
fix PHI  translation to take the PHI out of the instinputs set and add
the translated value back to it if an instruction.

Modified:
    llvm/trunk/lib/Analysis/PHITransAddr.cpp

Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=90909&r1=90908&r2=90909&view=diff

==============================================================================
--- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original)
+++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Tue Dec  8 18:18:13 2009
@@ -164,22 +164,20 @@
       // input.
       return Inst;
     }
-  
-    // If 'Inst' is defined in this block, it must be an input that needs to be
-    // phi translated or an intermediate expression that needs to be incorporated
-    // into the expression.
-    
+
+    // If 'Inst' is defined in this block and is an input that needs to be phi
+    // translated, we need to incorporate the value into the expression or fail.
+
     // If this is a PHI, go ahead and translate it.
     if (PHINode *PN = dyn_cast<PHINode>(Inst))
-      return PN->getIncomingValueForBlock(PredBB);
-
+      return ReplaceInstWithValue(PN, PN->getIncomingValueForBlock(PredBB));
     
     // If this is a non-phi value, and it is analyzable, we can incorporate it
     // into the expression by making all instruction operands be inputs.
     if (!CanPHITrans(Inst))
       return 0;
-    
-    // Okay, we can incorporate it, this instruction is no longer an input.
+   
+    // The instruction itself isn't an input any longer.
     InstInputs.erase(std::find(InstInputs.begin(), InstInputs.end(), Inst));
     
     // All instruction operands are now inputs (and of course, they may also be





More information about the llvm-commits mailing list