summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-27 06:31:14 +0000
committerChris Lattner <sabre@nondot.org>2009-11-27 06:31:14 +0000
commita9a76ccf56ba0aeba3d913ddc45f8468289a837c (patch)
treec5a27fa653177d1c48a840435661dedb74f13e2d /llvm/lib/Transforms
parentb018bda6651d954e1cb728769b098289084d136b (diff)
downloadbcm5719-llvm-a9a76ccf56ba0aeba3d913ddc45f8468289a837c.tar.gz
bcm5719-llvm-a9a76ccf56ba0aeba3d913ddc45f8468289a837c.zip
Fix phi translation in load PRE to agree with the phi
translation done by memdep, and reenable gep translation again. llvm-svn: 89992
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index a8f39c1433c..e8780503640 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1427,13 +1427,19 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
// If the loaded pointer is PHI node defined in this block, do PHI translation
// to get its value in the predecessor.
- Value *LoadPtr = LI->getOperand(0)->DoPHITranslation(LoadBB, UnavailablePred);
+ Value *LoadPtr = MD->PHITranslatePointer(LI->getOperand(0),
+ LoadBB, UnavailablePred, TD);
+ if (LoadPtr == 0) {
+ DEBUG(errs() << "COULDN'T PRE LOAD BECAUSE PTR CAN'T BE PHI TRANSLATED: "
+ << *LI->getOperand(0) << '\n' << *LI << "\n");
+ return false;
+ }
// Make sure the value is live in the predecessor. If it was defined by a
// non-PHI instruction in this block, we don't know how to recompute it above.
if (Instruction *LPInst = dyn_cast<Instruction>(LoadPtr))
if (!DT->dominates(LPInst->getParent(), UnavailablePred)) {
- DEBUG(errs() << "COULDN'T PRE LOAD BECAUSE PTR IS UNAVAILABLE IN PRED: "
+ DEBUG(errs() << "COULDN'T PRE LOAD BECAUSE PTR DOES NOT DOMINATE PRED: "
<< *LPInst << '\n' << *LI << "\n");
return false;
}
OpenPOWER on IntegriCloud