aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
diff options
context:
space:
mode:
authorNikita Popov <npopov@redhat.com>2022-10-21 12:16:57 +0200
committerNikita Popov <npopov@redhat.com>2022-10-21 12:18:57 +0200
commiteb470e67c148089d8d5c0c379a569ac55591546c (patch)
tree29b6dd8a22c3cba0e8d9f117cd9c8052f79f6d86 /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
parentfd236772f5665ce9e55f85ac992be6c22a918d3e (diff)
downloadllvm-eb470e67c148089d8d5c0c379a569ac55591546c.zip
llvm-eb470e67c148089d8d5c0c379a569ac55591546c.tar.gz
llvm-eb470e67c148089d8d5c0c379a569ac55591546c.tar.bz2
[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.
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/ModuleSummaryAnalysis.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index efe6058..52827c2 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.