summaryrefslogtreecommitdiff
path: root/lib/Analysis/PHITransAddr.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-12-09 00:18:13 +0000
committerChris Lattner <sabre@nondot.org>2009-12-09 00:18:13 +0000
commite09e98c2de28a7dbbc4d3712c174596443a7a3f1 (patch)
tree47a55bd8ba155ed8b8e30689f82c4c5c63e51773 /lib/Analysis/PHITransAddr.cpp
parentaf50315a29600188a6ff8b935beca6f1b59edf48 (diff)
downloadllvm-e09e98c2de28a7dbbc4d3712c174596443a7a3f1.tar.gz
llvm-e09e98c2de28a7dbbc4d3712c174596443a7a3f1.tar.bz2
llvm-e09e98c2de28a7dbbc4d3712c174596443a7a3f1.tar.xz
fix PHI translation to take the PHI out of the instinputs set and add
the translated value back to it if an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@90909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/PHITransAddr.cpp')
-rw-r--r--lib/Analysis/PHITransAddr.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/lib/Analysis/PHITransAddr.cpp b/lib/Analysis/PHITransAddr.cpp
index 2dbdb1981a..04f3f5dcfc 100644
--- a/lib/Analysis/PHITransAddr.cpp
+++ b/lib/Analysis/PHITransAddr.cpp
@@ -164,22 +164,20 @@ Value *PHITransAddr::PHITranslateSubExpr(Value *V, BasicBlock *CurBB,
// 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