aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Passes/PassBuilderPipelines.cpp
diff options
context:
space:
mode:
authorPaul Kirth <paulkirth@google.com>2024-01-23 14:04:52 -0800
committerGitHub <noreply@github.com>2024-01-23 14:04:52 -0800
commit9d476e1e1a18af390e3455a6622ee67a69c64103 (patch)
treef4dfc7844153746db48b935dd4123f1d64cf7bd4 /llvm/lib/Passes/PassBuilderPipelines.cpp
parenta829f109ffd518230df5191c64aa427603cf10d9 (diff)
downloadllvm-9d476e1e1a18af390e3455a6622ee67a69c64103.zip
llvm-9d476e1e1a18af390e3455a6622ee67a69c64103.tar.gz
llvm-9d476e1e1a18af390e3455a6622ee67a69c64103.tar.bz2
[clang][FatLTO] Avoid UnifiedLTO until it can support WPD/CFI (#79061)
Currently, the UnifiedLTO pipeline seems to have trouble with several LTO features, like SplitLTO units, which means we cannot use important optimizations like Whole Program Devirtualization or security hardening instrumentation like CFI. This patch reverts FatLTO to using distinct pipelines for Full LTO and ThinLTO. It still avoids module cloning, since that was error prone.
Diffstat (limited to 'llvm/lib/Passes/PassBuilderPipelines.cpp')
-rw-r--r--llvm/lib/Passes/PassBuilderPipelines.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index 525b83d..6ede863 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1531,14 +1531,17 @@ PassBuilder::buildPerModuleDefaultPipeline(OptimizationLevel Level,
}
ModulePassManager
-PassBuilder::buildFatLTODefaultPipeline(OptimizationLevel Level) {
+PassBuilder::buildFatLTODefaultPipeline(OptimizationLevel Level, bool ThinLTO,
+ bool EmitSummary) {
ModulePassManager MPM;
- // FatLTO always uses UnifiedLTO, so use the ThinLTOPreLink pipeline
- MPM.addPass(buildThinLTOPreLinkDefaultPipeline(Level));
- MPM.addPass(EmbedBitcodePass());
+ if (ThinLTO)
+ MPM.addPass(buildThinLTOPreLinkDefaultPipeline(Level));
+ else
+ MPM.addPass(buildLTOPreLinkDefaultPipeline(Level));
+ MPM.addPass(EmbedBitcodePass(ThinLTO, EmitSummary));
- // Use the ThinLTO post-link pipeline with sample profiling, other
- if (PGOOpt && PGOOpt->Action == PGOOptions::SampleUse)
+ // Use the ThinLTO post-link pipeline with sample profiling
+ if (ThinLTO && PGOOpt && PGOOpt->Action == PGOOptions::SampleUse)
MPM.addPass(buildThinLTODefaultPipeline(Level, /*ImportSummary=*/nullptr));
else {
// otherwise, just use module optimization