diff options
author | Chris Lattner <sabre@nondot.org> | 2009-12-09 00:18:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-12-09 00:18:13 +0000 |
commit | 37251f83759c90f0ede2af9bae5c62c2e634fc8e (patch) | |
tree | 463cbb9158eb93927dfdd271db33156f6c99a739 /llvm/lib/Analysis/PHITransAddr.cpp | |
parent | cfd76375e3824f512efcd9c789119b4b2b6302df (diff) | |
download | bcm5719-llvm-37251f83759c90f0ede2af9bae5c62c2e634fc8e.tar.gz bcm5719-llvm-37251f83759c90f0ede2af9bae5c62c2e634fc8e.zip |
fix PHI translation to take the PHI out of the instinputs set and add
the translated value back to it if an instruction.
llvm-svn: 90909
Diffstat (limited to 'llvm/lib/Analysis/PHITransAddr.cpp')
-rw-r--r-- | llvm/lib/Analysis/PHITransAddr.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Analysis/PHITransAddr.cpp b/llvm/lib/Analysis/PHITransAddr.cpp index 2dbdb1981a0..04f3f5dcfc9 100644 --- a/llvm/lib/Analysis/PHITransAddr.cpp +++ b/llvm/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 |