From a9a76ccf56ba0aeba3d913ddc45f8468289a837c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Fri, 27 Nov 2009 06:31:14 +0000 Subject: Fix phi translation in load PRE to agree with the phi translation done by memdep, and reenable gep translation again. llvm-svn: 89992 --- llvm/lib/Transforms/Scalar/GVN.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'llvm/lib/Transforms') 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(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; } -- cgit v1.2.3