Skip to content

Commit b8ea06d

Browse files
mtrofinronlieb
authored andcommitted
[nfc][ctx_prof] Use one flag for the "use" scenario (llvm#103377)
Change-Id: I413faf1de66b794b329fbab5170deb319f1f5173
1 parent 16a272f commit b8ea06d

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

llvm/lib/Transforms/IPO/FunctionImport.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ static cl::opt<std::string> WorkloadDefinitions(
176176

177177
extern cl::opt<std::string> UseCtxProfile;
178178

179-
static cl::opt<std::string>
180-
ContextualProfile("thinlto-pgo-ctx-prof",
181-
cl::desc("Path to a contextual profile."), cl::Hidden);
182-
183179
namespace llvm {
184180
extern cl::opt<bool> EnableMemProfContextDisambiguation;
185181
}
@@ -713,7 +709,7 @@ class WorkloadImportsManager : public ModuleImportsManager {
713709

714710
void loadFromCtxProf() {
715711
std::error_code EC;
716-
auto BufferOrErr = MemoryBuffer::getFileOrSTDIN(ContextualProfile);
712+
auto BufferOrErr = MemoryBuffer::getFileOrSTDIN(UseCtxProfile);
717713
if (std::error_code EC = BufferOrErr.getError()) {
718714
report_fatal_error("Failed to open contextual profile file");
719715
return;
@@ -764,12 +760,12 @@ class WorkloadImportsManager : public ModuleImportsManager {
764760
const ModuleSummaryIndex &Index,
765761
DenseMap<StringRef, FunctionImporter::ExportSetTy> *ExportLists)
766762
: ModuleImportsManager(IsPrevailing, Index, ExportLists) {
767-
if (ContextualProfile.empty() == WorkloadDefinitions.empty()) {
763+
if (UseCtxProfile.empty() == WorkloadDefinitions.empty()) {
768764
report_fatal_error(
769765
"Pass only one of: -thinlto-pgo-ctx-prof or -thinlto-workload-def");
770766
return;
771767
}
772-
if (!ContextualProfile.empty())
768+
if (!UseCtxProfile.empty())
773769
loadFromCtxProf();
774770
else
775771
loadFromJson();
@@ -791,7 +787,7 @@ std::unique_ptr<ModuleImportsManager> ModuleImportsManager::create(
791787
IsPrevailing,
792788
const ModuleSummaryIndex &Index,
793789
DenseMap<StringRef, FunctionImporter::ExportSetTy> *ExportLists) {
794-
if (WorkloadDefinitions.empty() && ContextualProfile.empty()) {
790+
if (WorkloadDefinitions.empty() && UseCtxProfile.empty()) {
795791
LLVM_DEBUG(dbgs() << "[Workload] Using the regular imports manager.\n");
796792
return std::unique_ptr<ModuleImportsManager>(
797793
new ModuleImportsManager(IsPrevailing, Index, ExportLists));

llvm/test/Analysis/CtxProfAnalysis/full-cycle.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
; REQUIRES: x86_64-linux
2-
; XFAIL: *
32

43
; RUN: rm -rf %t
54
; RUN: split-file %s %t

llvm/test/ThinLTO/X86/ctxprof.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
; RUN: llvm-ctxprof-util fromJSON --input %t_exp/ctxprof.json --output %t_exp/ctxprof.bitstream
4747
; RUN: llvm-lto2 run %t/m1.bc %t/m2.bc \
4848
; RUN: -o %t_exp/result.o -save-temps \
49-
; RUN: -thinlto-pgo-ctx-prof=%t_exp/ctxprof.bitstream \
49+
; RUN: -use-ctx-profile=%t_exp/ctxprof.bitstream \
5050
; RUN: -r %t/m1.bc,m1_f1,plx \
5151
; RUN: -r %t/m2.bc,m2_f1,plx
5252
; RUN: llvm-dis %t_exp/result.o.1.3.import.bc -o - | FileCheck %s --check-prefix=FIRST

0 commit comments

Comments
 (0)