Skip to content

Commit 633f566

Browse files
committed
[LegacyPM] Remove ThinLTO bitcode writer legacy pass
Using the legacy PM for the optimization pipeline is deprecated and in the process of being removed. This is a small step in that direction. For an example of migrating to the new PM: 853b57f
1 parent 853b57f commit 633f566

File tree

3 files changed

+2
-52
lines changed

3 files changed

+2
-52
lines changed

llvm/include/llvm/Transforms/IPO.h

-4
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,6 @@ ModulePass *createCrossDSOCFIPass();
240240
/// devirtualization and control-flow integrity.
241241
ModulePass *createGlobalSplitPass();
242242

243-
/// Write ThinLTO-ready bitcode to Str.
244-
ModulePass *createWriteThinLTOBitcodePass(raw_ostream &Str,
245-
raw_ostream *ThinLinkOS = nullptr);
246-
247243
} // End llvm namespace
248244

249245
#endif

llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp

-46
Original file line numberDiff line numberDiff line change
@@ -546,54 +546,8 @@ void writeThinLTOBitcode(raw_ostream &OS, raw_ostream *ThinLinkOS,
546546
writeThinLinkBitcodeToFile(M, *ThinLinkOS, *Index, ModHash);
547547
}
548548

549-
class WriteThinLTOBitcode : public ModulePass {
550-
raw_ostream &OS; // raw_ostream to print on
551-
// The output stream on which to emit a minimized module for use
552-
// just in the thin link, if requested.
553-
raw_ostream *ThinLinkOS = nullptr;
554-
555-
public:
556-
static char ID; // Pass identification, replacement for typeid
557-
WriteThinLTOBitcode() : ModulePass(ID), OS(dbgs()) {
558-
initializeWriteThinLTOBitcodePass(*PassRegistry::getPassRegistry());
559-
}
560-
561-
explicit WriteThinLTOBitcode(raw_ostream &o, raw_ostream *ThinLinkOS)
562-
: ModulePass(ID), OS(o), ThinLinkOS(ThinLinkOS) {
563-
initializeWriteThinLTOBitcodePass(*PassRegistry::getPassRegistry());
564-
}
565-
566-
StringRef getPassName() const override { return "ThinLTO Bitcode Writer"; }
567-
568-
bool runOnModule(Module &M) override {
569-
const ModuleSummaryIndex *Index =
570-
&(getAnalysis<ModuleSummaryIndexWrapperPass>().getIndex());
571-
writeThinLTOBitcode(OS, ThinLinkOS, LegacyAARGetter(*this), M, Index);
572-
return true;
573-
}
574-
void getAnalysisUsage(AnalysisUsage &AU) const override {
575-
AU.setPreservesAll();
576-
AU.addRequired<AssumptionCacheTracker>();
577-
AU.addRequired<ModuleSummaryIndexWrapperPass>();
578-
AU.addRequired<TargetLibraryInfoWrapperPass>();
579-
}
580-
};
581549
} // anonymous namespace
582550

583-
char WriteThinLTOBitcode::ID = 0;
584-
INITIALIZE_PASS_BEGIN(WriteThinLTOBitcode, "write-thinlto-bitcode",
585-
"Write ThinLTO Bitcode", false, true)
586-
INITIALIZE_PASS_DEPENDENCY(AssumptionCacheTracker)
587-
INITIALIZE_PASS_DEPENDENCY(ModuleSummaryIndexWrapperPass)
588-
INITIALIZE_PASS_DEPENDENCY(TargetLibraryInfoWrapperPass)
589-
INITIALIZE_PASS_END(WriteThinLTOBitcode, "write-thinlto-bitcode",
590-
"Write ThinLTO Bitcode", false, true)
591-
592-
ModulePass *llvm::createWriteThinLTOBitcodePass(raw_ostream &Str,
593-
raw_ostream *ThinLinkOS) {
594-
return new WriteThinLTOBitcode(Str, ThinLinkOS);
595-
}
596-
597551
PreservedAnalyses
598552
llvm::ThinLTOBitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
599553
FunctionAnalysisManager &FAM =

llvm/tools/opt/opt.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -970,8 +970,8 @@ int main(int argc, char **argv) {
970970
report_fatal_error("Text output is incompatible with -module-hash");
971971
Passes.add(createPrintModulePass(*OS, "", PreserveAssemblyUseListOrder));
972972
} else if (OutputThinLTOBC)
973-
Passes.add(createWriteThinLTOBitcodePass(
974-
*OS, ThinLinkOut ? &ThinLinkOut->os() : nullptr));
973+
report_fatal_error(
974+
"Use the new pass manager for printing ThinLTO bitcode");
975975
else
976976
Passes.add(createBitcodeWriterPass(*OS, PreserveBitcodeUseListOrder,
977977
EmitSummaryIndex, EmitModuleHash));

0 commit comments

Comments
 (0)