[llvm] eb470e6 - [ModuleSummaryAnalysis] Use helper methods to check readnone/readonly (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 21 03:19:08 PDT 2022


Author: Nikita Popov
Date: 2022-10-21T12:18:57+02:00
New Revision: eb470e67c148089d8d5c0c379a569ac55591546c

URL: https://github.com/llvm/llvm-project/commit/eb470e67c148089d8d5c0c379a569ac55591546c
DIFF: https://github.com/llvm/llvm-project/commit/eb470e67c148089d8d5c0c379a569ac55591546c.diff

LOG: [ModuleSummaryAnalysis] Use helper methods to check readnone/readonly (NFC)

This makes sure that this code continue working when switching to
the memory attribute.

A caveat here is that onlyReadsMemory() will also true for readnone.
To be conservative, I'm explicitly excluding that case here.

Added: 
    

Modified: 
    llvm/lib/Analysis/ModuleSummaryAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index efe60586979a9..52827c210b5ad 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -492,8 +492,7 @@ static void computeFunctionSummary(
       F.getLinkage(), F.getVisibility(), NotEligibleForImport,
       /* Live = */ false, F.isDSOLocal(), F.canBeOmittedFromSymbolTable());
   FunctionSummary::FFlags FunFlags{
-      F.hasFnAttribute(Attribute::ReadNone),
-      F.hasFnAttribute(Attribute::ReadOnly),
+      F.doesNotAccessMemory(), F.onlyReadsMemory() && !F.doesNotAccessMemory(),
       F.hasFnAttribute(Attribute::NoRecurse), F.returnDoesNotAlias(),
       // FIXME: refactor this to use the same code that inliner is using.
       // Don't try to import functions with noinline attribute.


        


More information about the llvm-commits mailing list