Skip to content

Commit

Permalink
[ctx_prof] Relax the "profile use" case around PGOOpt (llvm#108265)
Browse files Browse the repository at this point in the history
`PGOOpt` could have a value if, for instance, debug info for profiling
is requested. Relaxing the requirement, for now, following that
eventually we would factor `PGOOpt` to better capture the supported
interplay between the various profiling options.
  • Loading branch information
mtrofin committed Sep 11, 2024
1 parent b3f3c0c commit 9c0ba62
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Passes/PassBuilderPipelines.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,8 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
// Enable contextual profiling instrumentation.
const bool IsCtxProfGen = !IsPGOInstrGen && IsPreLink &&
PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
const bool IsCtxProfUse = !UseCtxProfile.empty() && !PGOOpt &&
Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
const bool IsCtxProfUse =
!UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink;

if (IsPGOInstrGen || IsPGOInstrUse || IsMemprofUse || IsCtxProfGen ||
IsCtxProfUse)
Expand Down Expand Up @@ -1673,7 +1673,7 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
// In pre-link, for ctx prof use, we stop here with an instrumented IR. We let
// thinlto use the contextual info to perform imports; then use the contextual
// profile in the post-thinlink phase.
if (!UseCtxProfile.empty() && !PGOOpt) {
if (!UseCtxProfile.empty()) {
addRequiredLTOPreLinkPasses(MPM);
return MPM;
}
Expand Down
1 change: 1 addition & 0 deletions llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
; There is no scenario currently of doing ctx profile use without thinlto.
;
; RUN: opt -passes='thinlto-pre-link<O2>' -use-ctx-profile=something_that_does_not_exist %s -S | FileCheck %s
; RUN: opt -debug-info-for-profiling -passes='thinlto-pre-link<O2>' -use-ctx-profile=something_that_does_not_exist %s -S | FileCheck %s

declare void @bar()

Expand Down

0 comments on commit 9c0ba62

Please sign in to comment.