diff options
author | Dan Gohman <gohman@apple.com> | 2010-08-05 23:34:50 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2010-08-05 23:34:50 +0000 |
commit | 130073904ffc18a6700bf7a6505ed2e19fc25ff3 (patch) | |
tree | 7fb302e836c8642d0977b04d5951f2bd578983e7 /lib | |
parent | 0c3f3358df14dcf9b30448d9482b35fe9c657ec8 (diff) | |
download | external_llvm-130073904ffc18a6700bf7a6505ed2e19fc25ff3.zip external_llvm-130073904ffc18a6700bf7a6505ed2e19fc25ff3.tar.gz external_llvm-130073904ffc18a6700bf7a6505ed2e19fc25ff3.tar.bz2 |
Implement AccessesArguments checking in the two-callsite form
of BasicAA::getModRefInfo. This allows BasicAA to say that two
memset calls to non-aliasing memory locations don't interfere.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@110393 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Analysis/BasicAliasAnalysis.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp index 11cba99..33c04c1 100644 --- a/lib/Analysis/BasicAliasAnalysis.cpp +++ b/lib/Analysis/BasicAliasAnalysis.cpp @@ -429,13 +429,43 @@ BasicAliasAnalysis::getModRefInfo(ImmutableCallSite CS1, if (CS1B == OnlyReadsMemory && CS2B == OnlyReadsMemory) return NoModRef; + AliasAnalysis::ModRefResult Mask = ModRef; + // If CS1 only reads memory, the only dependence on CS2 can be // from CS1 reading memory written by CS2. if (CS1B == OnlyReadsMemory) - return Ref; + Mask = ModRefResult(Mask & Ref); + // If CS2 only access memory through arguments, accumulate the mod/ref + // information from CS1's references to the memory referenced by + // CS2's arguments. + if (CS2B == AccessesArguments) { + AliasAnalysis::ModRefResult R = NoModRef; + for (ImmutableCallSite::arg_iterator + I = CS2.arg_begin(), E = CS2.arg_end(); I != E; ++I) { + R = ModRefResult((R | getModRefInfo(CS1, *I, UnknownSize)) & Mask); + if (R == Mask) + break; + } + return R; + } + + // If CS1 only accesses memory through arguments, check if CS2 references + // any of the memory referenced by CS1's arguments. If not, return NoModRef. + if (CS1B == AccessesArguments) { + AliasAnalysis::ModRefResult R = NoModRef; + for (ImmutableCallSite::arg_iterator + I = CS1.arg_begin(), E = CS1.arg_end(); I != E; ++I) + if (getModRefInfo(CS2, *I, UnknownSize) != NoModRef) { + R = Mask; + break; + } + if (R == NoModRef) + return R; + } + // Otherwise, fall back to NoAA (mod+ref). - return NoAA::getModRefInfo(CS1, CS2); + return ModRefResult(NoAA::getModRefInfo(CS1, CS2) & Mask); } /// GetIndexDifference - Dest and Src are the variable indices from two |