Skip to content

Commit aa7a62f

Browse files
committed
[ctxprof] Override type of instrumentation if -profile-context-root is specified
1 parent f6703a4 commit aa7a62f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,10 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
12061206

12071207
// We already asserted this happens in non-FullLTOPostLink earlier.
12081208
const bool IsPreLink = Phase != ThinOrFullLTOPhase::ThinLTOPostLink;
1209-
const bool IsPGOPreLink = PGOOpt && IsPreLink;
1209+
// Enable contextual profiling instrumentation.
1210+
const bool IsCtxProfGen =
1211+
IsPreLink && PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
1212+
const bool IsPGOPreLink = !IsCtxProfGen && PGOOpt && IsPreLink;
12101213
const bool IsPGOInstrGen =
12111214
IsPGOPreLink && PGOOpt->Action == PGOOptions::IRInstr;
12121215
const bool IsPGOInstrUse =
@@ -1217,9 +1220,6 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
12171220
assert(!(IsPGOInstrGen && PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled()) &&
12181221
"Enabling both instrumented PGO and contextual instrumentation is not "
12191222
"supported.");
1220-
// Enable contextual profiling instrumentation.
1221-
const bool IsCtxProfGen = !IsPGOInstrGen && IsPreLink &&
1222-
PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
12231223
const bool IsCtxProfUse =
12241224
!UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
12251225

0 commit comments

Comments
 (0)