summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Passes/PassBuilder.cpp4
-rw-r--r--llvm/test/Other/new-pm-thinlto-defaults.ll4
2 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/Passes/PassBuilder.cpp b/llvm/lib/Passes/PassBuilder.cpp
index 8b333b7f8a6..90561b05e62 100644
--- a/llvm/lib/Passes/PassBuilder.cpp
+++ b/llvm/lib/Passes/PassBuilder.cpp
@@ -710,7 +710,9 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
MainCGPipeline.addPass(createCGSCCToFunctionPassAdaptor(
buildFunctionSimplificationPipeline(Level, Phase, DebugLogging)));
- if (EnableHotColdSplit)
+ // We only want to do hot cold splitting once for ThinLTO, during the
+ // post-link ThinLTO.
+ if (EnableHotColdSplit && Phase != ThinLTOPhase::PreLink)
MPM.addPass(HotColdSplittingPass());
for (auto &C : CGSCCOptimizerLateEPCallbacks)
diff --git a/llvm/test/Other/new-pm-thinlto-defaults.ll b/llvm/test/Other/new-pm-thinlto-defaults.ll
index 001e3eeeb96..c68aa1d05aa 100644
--- a/llvm/test/Other/new-pm-thinlto-defaults.ll
+++ b/llvm/test/Other/new-pm-thinlto-defaults.ll
@@ -26,6 +26,10 @@
; RUN: opt -disable-verify -debug-pass-manager -new-pm-debug-info-for-profiling \
; RUN: -passes='thinlto-pre-link<O2>,name-anon-globals' -S %s 2>&1 \
; RUN: | FileCheck %s --check-prefixes=CHECK-DIS,CHECK-O,CHECK-O2,CHECK-PRELINK-O,CHECK-PRELINK-O2
+; Enabling the hot-cold-split pass should not affect the ThinLTO pre-link
+; RUN: opt -disable-verify -debug-pass-manager \
+; RUN: -passes='thinlto-pre-link<O2>,name-anon-globals' -hot-cold-split -S %s 2>&1 \
+; RUN: | FileCheck %s --check-prefixes=CHECK-O,CHECK-O2,CHECK-PRELINK-O,CHECK-PRELINK-O-NODIS,CHECK-PRELINK-O2
;
; Postlink pipelines:
; RUN: opt -disable-verify -debug-pass-manager \
OpenPOWER on IntegriCloud