summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-09-28 06:49:44 +0000
committerChris Lattner <sabre@nondot.org>2009-09-28 06:49:44 +0000
commit0261b5d2d2f59da443196f11eb17af3aee8a4480 (patch)
treeb1c0f0a4d06787616cb51aaec1a634bf47c83b3c /llvm/lib
parent14d1bf43618e9ba5efb53a751d8d999a44b8e918 (diff)
downloadbcm5719-llvm-0261b5d2d2f59da443196f11eb17af3aee8a4480.tar.gz
bcm5719-llvm-0261b5d2d2f59da443196f11eb17af3aee8a4480.zip
The select instruction is not neccesarily in the same block as the
phi nodes. Make sure to phi translate from the right block. This fixes a llvm-building-llvm failure on GVN-PRE.cpp llvm-svn: 82970
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/InstructionCombining.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
index 6826e132735..561527cbb46 100644
--- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -2002,10 +2002,11 @@ Instruction *InstCombiner::FoldOpIntoPhi(Instruction &I,
// not the true/false values.
Value *TrueV = SI->getTrueValue();
Value *FalseV = SI->getFalseValue();
+ BasicBlock *PhiTransBB = PN->getParent();
for (unsigned i = 0; i != NumPHIValues; ++i) {
BasicBlock *ThisBB = PN->getIncomingBlock(i);
- Value *TrueVInPred = TrueV->DoPHITranslation(I.getParent(), ThisBB);
- Value *FalseVInPred = FalseV->DoPHITranslation(I.getParent(), ThisBB);
+ Value *TrueVInPred = TrueV->DoPHITranslation(PhiTransBB, ThisBB);
+ Value *FalseVInPred = FalseV->DoPHITranslation(PhiTransBB, ThisBB);
Value *InV = 0;
if (Constant *InC = dyn_cast<Constant>(PN->getIncomingValue(i))) {
InV = InC->isNullValue() ? FalseVInPred : TrueVInPred;
OpenPOWER on IntegriCloud