diff options
| author | Dan Gohman <gohman@apple.com> | 2010-12-10 20:47:03 +0000 | 
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2010-12-10 20:47:03 +0000 | 
| commit | 041f74e762c8092e38224da7d6abbc2acfa960b1 (patch) | |
| tree | 0447bab301e5ea4ad70700eaeb5f2bca961fdbd0 /llvm/lib/Analysis/BasicAliasAnalysis.cpp | |
| parent | 1c6196228ab79375fca7b9ad4fb32da4279c8d1a (diff) | |
| download | llvm-041f74e762c8092e38224da7d6abbc2acfa960b1.zip llvm-041f74e762c8092e38224da7d6abbc2acfa960b1.tar.gz llvm-041f74e762c8092e38224da7d6abbc2acfa960b1.tar.bz2  | |
Implement PartialAlias checking in BasicAA.
llvm-svn: 121520
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
| -rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 11 | 
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 3ab18fd..17a502e 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,  | 
