Skip to content

Commit 853b57f

Browse files
committed
[NFC][llvm-reduce] Use new pass manager for printing ThinLTO bitcode
1 parent e994905 commit 853b57f

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

llvm/tools/llvm-reduce/llvm-reduce.cpp

+16-14
Original file line numberDiff line numberDiff line change
@@ -17,27 +17,19 @@
1717
#include "DeltaManager.h"
1818
#include "ReducerWorkItem.h"
1919
#include "TestRunner.h"
20-
#include "llvm/Analysis/ProfileSummaryInfo.h"
2120
#include "llvm/Analysis/ModuleSummaryAnalysis.h"
22-
#include "llvm/ADT/SmallString.h"
21+
#include "llvm/Analysis/ProfileSummaryInfo.h"
2322
#include "llvm/Bitcode/BitcodeReader.h"
2423
#include "llvm/Bitcode/BitcodeWriter.h"
2524
#include "llvm/CodeGen/CommandFlags.h"
26-
#include "llvm/CodeGen/MachineFunction.h"
27-
#include "llvm/CodeGen/MachineModuleInfo.h"
28-
#include "llvm/IR/LegacyPassManager.h"
2925
#include "llvm/IR/LLVMContext.h"
30-
#include "llvm/IR/Verifier.h"
3126
#include "llvm/IRReader/IRReader.h"
32-
#include "llvm/MC/TargetRegistry.h"
27+
#include "llvm/Passes/PassBuilder.h"
3328
#include "llvm/Support/CommandLine.h"
34-
#include "llvm/Support/Host.h"
3529
#include "llvm/Support/InitLLVM.h"
36-
#include "llvm/Support/SourceMgr.h"
37-
#include "llvm/Support/TargetSelect.h"
3830
#include "llvm/Support/WithColor.h"
3931
#include "llvm/Support/raw_ostream.h"
40-
#include "llvm/Transforms/IPO.h"
32+
#include "llvm/Transforms/IPO/ThinLTOBitcodeWriter.h"
4133
#include <system_error>
4234
#include <vector>
4335

@@ -117,9 +109,19 @@ void writeOutput(ReducerWorkItem &M, StringRef Message) {
117109

118110
void writeBitcode(ReducerWorkItem &M, llvm::raw_ostream &OutStream) {
119111
if (M.LTOInfo && M.LTOInfo->IsThinLTO && M.LTOInfo->EnableSplitLTOUnit) {
120-
legacy::PassManager PM;
121-
PM.add(llvm::createWriteThinLTOBitcodePass(OutStream));
122-
PM.run(*(M.M));
112+
PassBuilder PB;
113+
LoopAnalysisManager LAM;
114+
FunctionAnalysisManager FAM;
115+
CGSCCAnalysisManager CGAM;
116+
ModuleAnalysisManager MAM;
117+
PB.registerModuleAnalyses(MAM);
118+
PB.registerCGSCCAnalyses(CGAM);
119+
PB.registerFunctionAnalyses(FAM);
120+
PB.registerLoopAnalyses(LAM);
121+
PB.crossRegisterProxies(LAM, FAM, CGAM, MAM);
122+
ModulePassManager MPM;
123+
MPM.addPass(ThinLTOBitcodeWriterPass(OutStream, nullptr));
124+
MPM.run(*M.M, MAM);
123125
} else {
124126
std::unique_ptr<ModuleSummaryIndex> Index;
125127
if (M.LTOInfo && M.LTOInfo->HasSummary) {

0 commit comments

Comments
 (0)