summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-11-10 20:37:15 +0000
committerDan Gohman <gohman@apple.com>2010-11-10 20:37:15 +0000
commit0a6021a54dfaca401f8a13b358165f980696151b (patch)
tree62e389fa716c2058f7a6c1b4e937c6146beaea95 /llvm/lib/Transforms
parente9ad7fecf02868cd03ac51aef35374b0ce3fec1c (diff)
downloadbcm5719-llvm-0a6021a54dfaca401f8a13b358165f980696151b.tar.gz
bcm5719-llvm-0a6021a54dfaca401f8a13b358165f980696151b.zip
Enhance GVN to do more precise alias queries for non-local memory
references. For example, this allows gvn to eliminate the load in this example: void foo(int n, int* p, int *q) { p[0] = 0; p[1] = 1; if (n) { *q = p[0]; } } llvm-svn: 118714
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/Scalar/GVN.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index a2fcca59841..e506d0efd7f 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -1351,8 +1351,10 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
SmallVectorImpl<Instruction*> &toErase) {
// Find the non-local dependencies of the load.
SmallVector<NonLocalDepResult, 64> Deps;
- MD->getNonLocalPointerDependency(LI->getPointerOperand(), true,
- LI->getParent(),
+ AliasAnalysis::Location Loc(LI->getPointerOperand(),
+ VN.getAliasAnalysis()->getTypeStoreSize(LI->getType()),
+ LI->getMetadata(LLVMContext::MD_tbaa));
+ MD->getNonLocalPointerDependency(Loc, true, LI->getParent(),
Deps);
//DEBUG(dbgs() << "INVESTIGATING NONLOCAL LOAD: "
// << Deps.size() << *LI << '\n');
OpenPOWER on IntegriCloud