summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-12-13 22:50:24 +0000
committerDan Gohman <gohman@apple.com>2010-12-13 22:50:24 +0000
commitc4bf5cac9fe8b68b755fc07d6890e443ba594dd3 (patch)
tree4b568afde0cc68f8a9e67ae71e5ad755b5fbe8fb /llvm/lib/Analysis
parent506bd56484a5969c91a7ea93a04142274d15c0d4 (diff)
downloadbcm5719-llvm-c4bf5cac9fe8b68b755fc07d6890e443ba594dd3.tar.gz
bcm5719-llvm-c4bf5cac9fe8b68b755fc07d6890e443ba594dd3.zip
Reapply r121520, PartialAlias implementation for BasicAA, now that
memdep is updated to handle it. llvm-svn: 121725
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 3ab18fd3c0d..17a502e1f78 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -857,6 +857,17 @@ BasicAliasAnalysis::aliasGEP(const GEPOperator *GEP1, uint64_t V1Size,
if (GEP1BaseOffset == 0 && GEP1VariableIndices.empty())
return MustAlias;
+ // If there is a difference betwen the pointers, but the difference is
+ // less than the size of the associated memory object, then we know
+ // that the objects are partially overlapping.
+ if (GEP1BaseOffset != 0 && GEP1VariableIndices.empty()) {
+ if (GEP1BaseOffset >= 0 ?
+ (V2Size != UnknownSize && (uint64_t)GEP1BaseOffset < V2Size) :
+ (V1Size != UnknownSize && -(uint64_t)GEP1BaseOffset < V1Size &&
+ GEP1BaseOffset != INT64_MIN))
+ return PartialAlias;
+ }
+
// If we have a known constant offset, see if this offset is larger than the
// access size being queried. If so, and if no variable indices can remove
// pieces of this constant, then we know we have a no-alias. For example,
OpenPOWER on IntegriCloud