Use the AliasAnalysis interface to determine how a Function accesses

memory. This isn't a real improvement with present day AliasAnalysis
implementations; it's mainly for consistency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@118624 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-11-09 20:13:27 +00:00
parent 1cdaa3e5b1
commit 6d44d64f61

View File

@ -101,14 +101,15 @@ bool FunctionAttrs::AddReadAttrs(const CallGraphSCC &SCC) {
// External node - may write memory. Just give up.
return false;
if (F->doesNotAccessMemory())
AliasAnalysis::ModRefBehavior MRB = AA->getModRefBehavior(F);
if (MRB == AliasAnalysis::DoesNotAccessMemory)
// Already perfect!
continue;
// Definitions with weak linkage may be overridden at linktime with
// something that writes memory, so treat them like declarations.
if (F->isDeclaration() || F->mayBeOverridden()) {
if (!F->onlyReadsMemory())
if (!AliasAnalysis::onlyReadsMemory(MRB))
// May write memory. Just give up.
return false;