aboutsummaryrefslogtreecommitdiff
path: root/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
commit075fb5d68fcb55d26e44c48f07dfdbbfa21ccb2a (patch)
treebd2ac0b33edd3125d8741077ff4a5c274276b35e /lib/Transforms
parentaf3d38f70ebba9fec0048c2540dbdf0168d280d2 (diff)
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]; } } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index a2fcca5984..e506d0efd7 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/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');