Skip to content

Commit 9c0ba62

Browse files
authored
[ctx_prof] Relax the "profile use" case around PGOOpt (#108265)
`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.
1 parent b3f3c0c commit 9c0ba62

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

llvm/lib/Passes/PassBuilderPipelines.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,8 +1181,8 @@ PassBuilder::buildModuleSimplificationPipeline(OptimizationLevel Level,
11811181
// Enable contextual profiling instrumentation.
11821182
const bool IsCtxProfGen = !IsPGOInstrGen && IsPreLink &&
11831183
PGOCtxProfLoweringPass::isCtxIRPGOInstrEnabled();
1184-
const bool IsCtxProfUse = !UseCtxProfile.empty() && !PGOOpt &&
1185-
Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
1184+
const bool IsCtxProfUse =
1185+
!UseCtxProfile.empty() && Phase == ThinOrFullLTOPhase::ThinLTOPreLink;
11861186

11871187
if (IsPGOInstrGen || IsPGOInstrUse || IsMemprofUse || IsCtxProfGen ||
11881188
IsCtxProfUse)
@@ -1673,7 +1673,7 @@ PassBuilder::buildThinLTOPreLinkDefaultPipeline(OptimizationLevel Level) {
16731673
// In pre-link, for ctx prof use, we stop here with an instrumented IR. We let
16741674
// thinlto use the contextual info to perform imports; then use the contextual
16751675
// profile in the post-thinlink phase.
1676-
if (!UseCtxProfile.empty() && !PGOOpt) {
1676+
if (!UseCtxProfile.empty()) {
16771677
addRequiredLTOPreLinkPasses(MPM);
16781678
return MPM;
16791679
}

llvm/test/Transforms/PGOProfile/ctx-prof-use-prelink.ll

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
; There is no scenario currently of doing ctx profile use without thinlto.
55
;
66
; RUN: opt -passes='thinlto-pre-link<O2>' -use-ctx-profile=something_that_does_not_exist %s -S | FileCheck %s
7+
; RUN: opt -debug-info-for-profiling -passes='thinlto-pre-link<O2>' -use-ctx-profile=something_that_does_not_exist %s -S | FileCheck %s
78

89
declare void @bar()
910

0 commit comments

Comments
 (0)