Skip to content

Commit 7e5bd8f

Browse files
authored
[SYCL][NewPM] Use new pass manager for LowerWGScope pass execution (#5324)
Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
1 parent 10c629a commit 7e5bd8f

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

clang/lib/CodeGen/CodeGenAction.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -332,9 +332,19 @@ namespace clang {
332332
// happens.
333333
if (LangOpts.SYCLIsDevice) {
334334
PrettyStackTraceString CrashInfo("Pre-linking SYCL passes");
335-
legacy::PassManager PreLinkingSyclPasses;
336-
PreLinkingSyclPasses.add(llvm::createSYCLLowerWGScopePass());
337-
PreLinkingSyclPasses.run(*getModule());
335+
336+
FunctionAnalysisManager FAM;
337+
ModuleAnalysisManager MAM;
338+
MAM.registerPass([&] { return PassInstrumentationAnalysis(); });
339+
MAM.registerPass(
340+
[&] { return FunctionAnalysisManagerModuleProxy(FAM); });
341+
FAM.registerPass(
342+
[&] { return ModuleAnalysisManagerFunctionProxy(MAM); });
343+
344+
ModulePassManager PreLinkingSyclPasses;
345+
PreLinkingSyclPasses.addPass(
346+
createModuleToFunctionPassAdaptor(SYCLLowerWGScopePass()));
347+
PreLinkingSyclPasses.run(*getModule(), MAM);
338348
}
339349

340350
// Link each LinkModule into our module.

clang/test/CodeGenSYCL/kernel-early-optimization-pipeline.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
// SYCL device target, and can be disabled with -fno-sycl-early-optimizations.
33
//
44
// RUN: %clang_cc1 -O2 -fsycl-is-device -triple spir64-unknown-unknown %s -flegacy-pass-manager -mllvm -debug-pass=Structure -emit-llvm -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-EARLYOPT
5-
// CHECK-EARLYOPT: Lower Work Group Scope Code
65
// CHECK-EARLYOPT: Combine redundant instructions
6+
// CHECK-EARLYOPT: Move SYCL printf literal arguments to constant address space
77
//
88
// RUN: %clang_cc1 -O2 -fsycl-is-device -triple spir64-unknown-unknown %s -flegacy-pass-manager -mllvm -debug-pass=Structure -emit-llvm -fno-sycl-early-optimizations -o /dev/null 2>&1 | FileCheck %s --check-prefix=CHECK-NOEARLYOPT
9-
// CHECK-NOEARLYOPT: Lower Work Group Scope Code
109
// CHECK-NOEARLYOPT-NOT: Combine redundant instructions
10+
// CHECK-NOEARLYOPT: Move SYCL printf literal arguments to constant address space
1111
//
1212
//
1313
// New pass manager doesn't print all passes tree, only module level.

0 commit comments

Comments
 (0)