[llvm-commits] [llvm] r90908 - in /llvm/trunk: include/llvm/Analysis/PHITransAddr.h lib/Analysis/PHITransAddr.cpp
Chris Lattner
sabre at nondot.org
Tue Dec 8 16:10:56 PST 2009
Author: lattner
Date: Tue Dec 8 18:10:55 2009
New Revision: 90908
URL: http://llvm.org/viewvc/llvm-project?rev=90908&view=rev
Log:
instructions defined in CurBB may be intermediate nodes of the computation.
Modified:
llvm/trunk/include/llvm/Analysis/PHITransAddr.h
llvm/trunk/lib/Analysis/PHITransAddr.cpp
Modified: llvm/trunk/include/llvm/Analysis/PHITransAddr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PHITransAddr.h?rev=90908&r1=90907&r2=90908&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PHITransAddr.h (original)
+++ llvm/trunk/include/llvm/Analysis/PHITransAddr.h Tue Dec 8 18:10:55 2009
@@ -83,9 +83,9 @@
void dump() const;
- /// Verify - Check internal consistency of this data structure. Though it
- /// claims to return a bool, it actually aborts on error and always returns
- /// true.
+ /// Verify - Check internal consistency of this data structure. If the
+ /// structure is valid, it returns true. If invalid, it prints errors and
+ /// returns false.
bool Verify() const;
private:
Value *PHITranslateSubExpr(Value *V, BasicBlock *CurBB, BasicBlock *PredBB);
Modified: llvm/trunk/lib/Analysis/PHITransAddr.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/PHITransAddr.cpp?rev=90908&r1=90907&r2=90908&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/PHITransAddr.cpp (original)
+++ llvm/trunk/lib/Analysis/PHITransAddr.cpp Tue Dec 8 18:10:55 2009
@@ -154,12 +154,20 @@
Instruction *Inst = dyn_cast<Instruction>(V);
if (Inst == 0) return V;
- // 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->getParent() == CurBB) {
- assert(std::count(InstInputs.begin(), InstInputs.end(), Inst) &&
- "Not an input?");
+ // Determine whether 'Inst' is an input to our PHI translatable expression.
+ bool isInput = std::count(InstInputs.begin(), InstInputs.end(), Inst);
+
+ // Handle inputs instructions if needed.
+ if (isInput) {
+ if (Inst->getParent() != CurBB) {
+ // If it is an input defined in a different block, then it remains an
+ // 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 this is a PHI, go ahead and translate it.
if (PHINode *PN = dyn_cast<PHINode>(Inst))
@@ -179,14 +187,6 @@
for (unsigned i = 0, e = Inst->getNumOperands(); i != e; ++i)
if (Instruction *Op = dyn_cast<Instruction>(Inst->getOperand(i)))
InstInputs.push_back(Op);
-
- } else {
- // Determine whether 'Inst' is an input to our PHI translatable expression.
- bool isInput = std::count(InstInputs.begin(), InstInputs.end(), Inst);
-
- // If it is an input defined in a different block, then it remains an input.
- if (isInput)
- return Inst;
}
// Ok, it must be an intermediate result (either because it started that way
More information about the llvm-commits
mailing list