diff options
author | Dan Gohman <gohman@apple.com> | 2010-12-13 22:50:24 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-12-13 22:50:24 +0000 |
commit | 0f7f194416b9f139d4233b499a1f56b20bd84022 (patch) | |
tree | 9c2b4fb3674e21706f973eed3a938f57cb189d89 /lib/Analysis/BasicAliasAnalysis.cpp | |
parent | 2cd195291722ad0153125a6c032c96e361d8c48e (diff) |
Reapply r121520, PartialAlias implementation for BasicAA, now that
memdep is updated to handle it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121725 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 3ab18fd3c0..17a502e1f7 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/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, |