[llvm] [ctxprof] Override type of instrumentation if `-profile-context-root` is specified (PR #128940)
Mircea Trofin via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 26 12:06:09 PST 2025
https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/128940
None
>From aa7a62f46e639c43ee6991fe5197cf091ea9401f Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Wed, 26 Feb 2025 12:05:45 -0800
Subject: [PATCH] [ctxprof] Override type of instrumentation if
`-profile-context-root` is specified
---
llvm/lib/Passes/PassBuilderPipelines.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/lib/Passes/PassBuilderPipelines.cpp b/llvm/lib/Passes/PassBuilderPipelines.cpp
index d4c3fe9562f9e..546a5eb1ec283 100644
--- a/llvm/lib/Passes/PassBuilderPipelines.cpp
+++ b/llvm/lib/Passes/PassBuilderPipelines.cpp
@@ -1206,7 +1206,10 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
// We already asserted this happens in non-FullLTOPostLink earlier.
const bool IsPreLink = Phase != ThinOrFullLTOPhase::ThinLTOPostLink;
- const bool IsPGOPreLink = PGOOpt && IsPreLink;
+ // Enable contextual profiling instrumentation.
+ const bool IsCtxProfGen =
+ IsPreLink && PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
+ const bool IsPGOPreLink = !IsCtxProfGen && PGOOpt && IsPreLink;
const bool IsPGOInstrGen =
IsPGOPreLink && PGOOpt->Action == PGOOptions::IRInstr;
const bool IsPGOInstrUse =
@@ -1217,9 +1220,6 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
assert(!(IsPGOInstrGen && PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled()) &&
"Enabling both instrumented PGO and contextual instrumentation is not "
"supported.");
- // Enable contextual profiling instrumentation.
- const bool IsCtxProfGen = !IsPGOInstrGen && IsPreLink &&
- PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
const bool IsCtxProfUse =
!UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
More information about the llvm-commits
mailing list