Skip to content

Commit 1f8bcbb

Browse files
authored
[sycl-post-link][NewPM] Port passes execution for extracted submodule… (#5337)
Signed-off-by: Mikhail Lychkov <[email protected]>
1 parent 30c834a commit 1f8bcbb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939
#include "llvm/Transforms/IPO.h"
4040
#include "llvm/Transforms/IPO/AlwaysInliner.h"
4141
#include "llvm/Transforms/IPO/GlobalDCE.h"
42+
#include "llvm/Transforms/IPO/StripDeadPrototypes.h"
43+
#include "llvm/Transforms/IPO/StripSymbols.h"
4244
#include "llvm/Transforms/InstCombine/InstCombine.h"
4345
#include "llvm/Transforms/Scalar.h"
4446
#include "llvm/Transforms/Utils/Cloning.h"
@@ -490,13 +492,14 @@ extractCallGraph(const Module &M, const EntryPointGroup &ModuleEntryPoints) {
490492
std::unique_ptr<Module> MClone = CloneModule(
491493
M, VMap, [&](const GlobalValue *GV) { return GVs.count(GV); });
492494

493-
// TODO: Use the new PassManager instead?
494-
legacy::PassManager Passes;
495+
ModuleAnalysisManager MAM;
496+
MAM.registerPass([&] { return PassInstrumentationAnalysis(); });
497+
ModulePassManager MPM;
495498
// Do cleanup.
496-
Passes.add(createGlobalDCEPass()); // Delete unreachable globals.
497-
Passes.add(createStripDeadDebugInfoPass()); // Remove dead debug info.
498-
Passes.add(createStripDeadPrototypesPass()); // Remove dead func decls.
499-
Passes.run(*MClone.get());
499+
MPM.addPass(GlobalDCEPass()); // Delete unreachable globals.
500+
MPM.addPass(StripDeadDebugInfoPass()); // Remove dead debug info.
501+
MPM.addPass(StripDeadPrototypesPass()); // Remove dead func decls.
502+
MPM.run(*MClone.get(), MAM);
500503

501504
return MClone;
502505
}

0 commit comments

Comments
 (0)