diff options
| author | Chris Lattner <sabre@nondot.org> | 2009-12-09 18:21:46 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2009-12-09 18:21:46 +0000 |
| commit | ca5f9cb18b7e56cde9fa903de6e0cdf07b366157 (patch) | |
| tree | b4fdc154a7745756fc0ba64eb0bdfdc712586a1b /llvm/lib | |
| parent | f8ba1253f1df8f0e4dae7ea8b349b5a6da97d9f1 (diff) | |
| download | bcm5719-llvm-ca5f9cb18b7e56cde9fa903de6e0cdf07b366157.tar.gz bcm5719-llvm-ca5f9cb18b7e56cde9fa903de6e0cdf07b366157.zip | |
fix hte last remaining known (by me) phi translation bug. When we reanalyze
clobbers to forward pieces of large stores to small loads, we need to consider
the properly phi translated pointer in the store block.
llvm-svn: 90978
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index ed4e0d61488..783da6a5635 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/lib/Transforms/Scalar/GVN.cpp @@ -1384,15 +1384,19 @@ bool GVN::processNonLocalLoad(LoadInst *LI, MemDepResult DepInfo = Deps[i].getResult(); if (DepInfo.isClobber()) { + // The address being loaded in this non-local block may not be the same as + // the pointer operand of the load if PHI translation occurs. Make sure + // to consider the right address. + Value *Address = Deps[i].getAddress(); + // If the dependence is to a store that writes to a superset of the bits // read by the load, we can extract the bits we need for the load from the // stored value. if (StoreInst *DepSI = dyn_cast<StoreInst>(DepInfo.getInst())) { if (TD == 0) TD = getAnalysisIfAvailable<TargetData>(); - if (TD) { - int Offset = AnalyzeLoadFromClobberingStore(LI->getType(), - LI->getPointerOperand(), + if (TD && Address) { + int Offset = AnalyzeLoadFromClobberingStore(LI->getType(), Address, DepSI, *TD); if (Offset != -1) { ValuesPerBlock.push_back(AvailableValueInBlock::get(DepBB, @@ -1408,9 +1412,8 @@ bool GVN::processNonLocalLoad(LoadInst *LI, if (MemIntrinsic *DepMI = dyn_cast<MemIntrinsic>(DepInfo.getInst())) { if (TD == 0) TD = getAnalysisIfAvailable<TargetData>(); - if (TD) { - int Offset = AnalyzeLoadFromClobberingMemInst(LI->getType(), - LI->getPointerOperand(), + if (TD && Address) { + int Offset = AnalyzeLoadFromClobberingMemInst(LI->getType(), Address, DepMI, *TD); if (Offset != -1) { ValuesPerBlock.push_back(AvailableValueInBlock::getMI(DepBB, DepMI, |

