Skip to content

Commit

Permalink
[SYCL][NewPM] Use new pass manager for LowerWGScope pass execution (#…
Browse files Browse the repository at this point in the history
…5324)

Signed-off-by: Mikhail Lychkov <mikhail.lychkov@intel.com>
  • Loading branch information
mlychkov authored Jan 22, 2022
1 parent 10c629a commit 7e5bd8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
16 changes: 13 additions & 3 deletions clang/lib/CodeGen/CodeGenAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,19 @@ namespace clang {
// happens.
if (LangOpts.SYCLIsDevice) {
PrettyStackTraceString CrashInfo("Pre-linking SYCL passes");
legacy::PassManager PreLinkingSyclPasses;
PreLinkingSyclPasses.add(llvm::createSYCLLowerWGScopePass());
PreLinkingSyclPasses.run(*getModule());

FunctionAnalysisManager FAM;
ModuleAnalysisManager MAM;
MAM.registerPass([&] { return PassInstrumentationAnalysis(); });
MAM.registerPass(
[&] { return FunctionAnalysisManagerModuleProxy(FAM); });
FAM.registerPass(
[&] { return ModuleAnalysisManagerFunctionProxy(MAM); });

ModulePassManager PreLinkingSyclPasses;
PreLinkingSyclPasses.addPass(
createModuleToFunctionPassAdaptor(SYCLLowerWGScopePass()));
PreLinkingSyclPasses.run(*getModule(), MAM);
}

// Link each LinkModule into our module.
Expand Down
4 changes: 2 additions & 2 deletions clang/test/CodeGenSYCL/kernel-early-optimization-pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
// SYCL device target, and can be disabled with -fno-sycl-early-optimizations.
//
// 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
// CHECK-EARLYOPT: Lower Work Group Scope Code
// CHECK-EARLYOPT: Combine redundant instructions
// CHECK-EARLYOPT: Move SYCL printf literal arguments to constant address space
//
// 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
// CHECK-NOEARLYOPT: Lower Work Group Scope Code
// CHECK-NOEARLYOPT-NOT: Combine redundant instructions
// CHECK-NOEARLYOPT: Move SYCL printf literal arguments to constant address space
//
//
// New pass manager doesn't print all passes tree, only module level.
Expand Down

0 comments on commit 7e5bd8f

Please sign in to comment.