aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/PHITransAddr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-09 00:10:55 +0000
committerChris Lattner <sabre@nondot.org>2009-12-09 00:10:55 +0000
commitaf50315a29600188a6ff8b935beca6f1b59edf48 (patch)
tree34c372ad0baf27a5730cfc7ce7f792b07180b529 /lib/Analysis/PHITransAddr.cpp
parent7dedbf4ce3e1b62b4e0b000b38d244b50029c315 (diff)
instructions defined in CurBB may be intermediate nodes of the computation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90908 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PHITransAddr.cpp')
-rw-r--r--lib/Analysis/PHITransAddr.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/lib/Analysis/PHITransAddr.cpp b/lib/Analysis/PHITransAddr.cpp
index 187924f45a..2dbdb1981a 100644
--- a/lib/Analysis/PHITransAddr.cpp
+++ b/lib/Analysis/PHITransAddr.cpp
@@ -154,12 +154,20 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
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 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
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