From eb470e67c148089d8d5c0c379a569ac55591546c Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Fri, 21 Oct 2022 12:16:57 +0200 Subject: [PATCH] [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. --- llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 3 +-- 1 file changed, 1 insertion(+), 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. -- 2.7.4