diff options
author | Teresa Johnson <tejohnson@google.com> | 2024-10-18 10:12:23 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-10-18 10:12:23 -0700 |
commit | 6264288d70610c40256f96f003e14ab5e8890fb8 (patch) | |
tree | 7688e8975a4529377f757783a1acbe8cf730adc2 /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | |
parent | 6c60ead15a8932b30823a89b6686f7cee240f751 (diff) | |
download | llvm-6264288d70610c40256f96f003e14ab5e8890fb8.zip llvm-6264288d70610c40256f96f003e14ab5e8890fb8.tar.gz llvm-6264288d70610c40256f96f003e14ab5e8890fb8.tar.bz2 |
[MemProf] Fix the option to disable memprof ICP (#112917)
The -enable-memprof-indirect-call-support meant to guard the recently
added memprof ICP support was not used in enough places. Specifically,
it was not checked in mayHaveMemprofSummary, which is called from the
ThinLTO backend applyImports. This led to failures when checking the
callsite records, as we incorrectly expected records for indirect calls.
Fix the option to be checked in all necessary locations, and add
testing.
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
-rw-r--r-- | llvm/lib/Analysis/ModuleSummaryAnalysis.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 1bd9ee6..0f4e85f 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -503,6 +503,10 @@ static void computeFunctionSummary( if (!IsThinLTO) continue; + // Skip indirect calls if we haven't enabled memprof ICP. + if (!CalledFunction && !EnableMemProfIndirectCallSupport) + continue; + // Ensure we keep this analysis in sync with the handling in the ThinLTO // backend (see MemProfContextDisambiguation::applyImport). Save this call // so that we can skip it in checking the reverse case later. @@ -561,7 +565,8 @@ static void computeFunctionSummary( auto CalleeValueInfo = Index.getOrInsertValueInfo(cast<GlobalValue>(CalledValue)); Callsites.push_back({CalleeValueInfo, StackIdIndices}); - } else if (EnableMemProfIndirectCallSupport) { + } else { + assert(EnableMemProfIndirectCallSupport); // For indirect callsites, create multiple Callsites, one per target. // This enables having a different set of clone versions per target, // and we will apply the cloning decisions while speculatively @@ -1223,6 +1228,9 @@ bool llvm::mayHaveMemprofSummary(const CallBase *CB) { if (CI && CalledFunction->isIntrinsic()) return false; } else { + // Skip indirect calls if we haven't enabled memprof ICP. + if (!EnableMemProfIndirectCallSupport) + return false; // Skip inline assembly calls. if (CI && CI->isInlineAsm()) return false; |