Skip to content

Commit c1d3d7c

Browse files
authored
[SYCL][New PM] Move code in sycl-post-link to new pass manager (#10455)
In the sycl-post-link tool, most of the changes towards moving the passes to use the new pass manager were added as part of this PR by Konstantin Bobrovsky: #6835 There was one site where legacy pass manager was used. This change moves that to use the new pass manager. It is sufficient to check for regression in existing tests. There is no need to add a new test. Thanks Sincerely --------- Signed-off-by: Arvind Sudarsanam <[email protected]>
1 parent e7ce30b commit c1d3d7c

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

llvm/tools/sycl-post-link/sycl-post-link.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,9 @@
2828
#include "llvm/Bitcode/BitcodeWriterPass.h"
2929
#include "llvm/GenXIntrinsics/GenXSPIRVWriterAdaptor.h"
3030
#include "llvm/IR/Dominators.h"
31-
#include "llvm/IR/IRPrintingPasses.h"
3231
#include "llvm/IR/LLVMContext.h"
33-
#include "llvm/IR/LegacyPassManager.h"
3432
#include "llvm/IR/Module.h"
33+
#include "llvm/IRPrinter/IRPrintingPasses.h"
3534
#include "llvm/IRReader/IRReader.h"
3635
#include "llvm/Linker/Linker.h"
3736
#include "llvm/Passes/PassBuilder.h"
@@ -336,14 +335,15 @@ void saveModuleIR(Module &M, StringRef OutFilename) {
336335
raw_fd_ostream Out{OutFilename, EC, sys::fs::OF_None};
337336
checkError(EC, "error opening the file '" + OutFilename + "'");
338337

339-
// TODO: Use the new PassManager instead?
340-
legacy::PassManager PrintModule;
341-
338+
ModulePassManager MPM;
339+
ModuleAnalysisManager MAM;
340+
PassBuilder PB;
341+
PB.registerModuleAnalyses(MAM);
342342
if (OutputAssembly)
343-
PrintModule.add(createPrintModulePass(Out, ""));
343+
MPM.addPass(PrintModulePass(Out));
344344
else if (Force || !CheckBitcodeOutputToConsole(Out))
345-
PrintModule.add(createBitcodeWriterPass(Out));
346-
PrintModule.run(M);
345+
MPM.addPass(BitcodeWriterPass(Out));
346+
MPM.run(M, MAM);
347347
}
348348

349349
std::string saveModuleIR(Module &M, int I, StringRef Suff) {

0 commit comments

Comments
 (0)