@@ -174,9 +174,7 @@ static cl::opt<std::string> WorkloadDefinitions(
174174 " }" ),
175175 cl::Hidden);
176176
177- static cl::opt<std::string>
178- ContextualProfile (" thinlto-pgo-ctx-prof" ,
179- cl::desc (" Path to a contextual profile." ), cl::Hidden);
177+ extern cl::opt<std::string> UseCtxProfile;
180178
181179namespace llvm {
182180extern cl::opt<bool > EnableMemProfContextDisambiguation;
@@ -671,7 +669,7 @@ class WorkloadImportsManager : public ModuleImportsManager {
671669
672670 void loadFromCtxProf () {
673671 std::error_code EC;
674- auto BufferOrErr = MemoryBuffer::getFileOrSTDIN (ContextualProfile );
672+ auto BufferOrErr = MemoryBuffer::getFileOrSTDIN (UseCtxProfile );
675673 if (std::error_code EC = BufferOrErr.getError ()) {
676674 report_fatal_error (" Failed to open contextual profile file" );
677675 return ;
@@ -722,12 +720,12 @@ class WorkloadImportsManager : public ModuleImportsManager {
722720 const ModuleSummaryIndex &Index,
723721 DenseMap<StringRef, FunctionImporter::ExportSetTy> *ExportLists)
724722 : ModuleImportsManager(IsPrevailing, Index, ExportLists) {
725- if (ContextualProfile .empty () == WorkloadDefinitions.empty ()) {
723+ if (UseCtxProfile .empty () == WorkloadDefinitions.empty ()) {
726724 report_fatal_error (
727725 " Pass only one of: -thinlto-pgo-ctx-prof or -thinlto-workload-def" );
728726 return ;
729727 }
730- if (!ContextualProfile .empty ())
728+ if (!UseCtxProfile .empty ())
731729 loadFromCtxProf ();
732730 else
733731 loadFromJson ();
@@ -749,7 +747,7 @@ std::unique_ptr<ModuleImportsManager> ModuleImportsManager::create(
749747 IsPrevailing,
750748 const ModuleSummaryIndex &Index,
751749 DenseMap<StringRef, FunctionImporter::ExportSetTy> *ExportLists) {
752- if (WorkloadDefinitions.empty () && ContextualProfile .empty ()) {
750+ if (WorkloadDefinitions.empty () && UseCtxProfile .empty ()) {
753751 LLVM_DEBUG (dbgs () << " [Workload] Using the regular imports manager.\n " );
754752 return std::unique_ptr<ModuleImportsManager>(
755753 new ModuleImportsManager (IsPrevailing, Index, ExportLists));
0 commit comments