aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2023-04-19 14:51:10 -0700
committerTeresa Johnson <tejohnson@google.com>2023-04-20 11:45:15 -0700
commit3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b (patch)
treee95855cb0ec33430203bd1d118fa48d6990f2af0 /llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
parent3ba4d082da3dd6856887774fab694f81adc15a64 (diff)
downloadllvm-3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b.zip
llvm-3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b.tar.gz
llvm-3adc6e03080c6d38a51f5c5b6744b7c0d9c7541b.tar.bz2
[ThinLTO] Remove BlockCount for non partial sample profile builds
As pointed out in https://discourse.llvm.org/t/undeterministic-thin-index-file/69985, the block count added to distributed ThinLTO index files breaks incremental builds on ThinLTO - if any linked file has a different number of BBs, then the accumulated sum placed in the index files will change, causing all ThinLTO backend compiles to be redone. The block count is only used for scaling of partial sample profiles, and was added in D80403 for D79831. This patch simply removes this field from the index files of non partial sample profile compiles, which is NFC on the output of the compiler. We subsequently need to see if this can be removed for partial sample profiles without signficant performance loss, or redesigned in a way that does not destroy caching. Differential Revision: https://reviews.llvm.org/D148746
Diffstat (limited to 'llvm/lib/Analysis/ModuleSummaryAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/ModuleSummaryAnalysis.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
index 26ff84f..d84cfbf 100644
--- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
+++ b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp
@@ -80,6 +80,8 @@ static cl::opt<std::string> ModuleSummaryDotFile(
"module-summary-dot-file", cl::Hidden, cl::value_desc("filename"),
cl::desc("File to emit dot graph of new summary into"));
+extern cl::opt<bool> ScalePartialSampleProfileWorkingSetSize;
+
// Walk through the operands of a given User via worklist iteration and populate
// the set of GlobalValue references encountered. Invoked either on an
// Instruction or a GlobalVariable (which walks its initializer).
@@ -477,7 +479,9 @@ static void computeFunctionSummary(
}
}
}
- Index.addBlockCount(F.size());
+
+ if (PSI->hasPartialSampleProfile() && ScalePartialSampleProfileWorkingSetSize)
+ Index.addBlockCount(F.size());
std::vector<ValueInfo> Refs;
if (IsThinLTO) {