Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion clang/lib/CodeGen/BackendUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1045,7 +1045,7 @@ void EmitAssemblyHelper::EmitAssemblyWithLegacyPassManager(
// used only with spir triple.
if (CodeGenOpts.SPIRITTAnnotations) {
assert(llvm::Triple(TheModule->getTargetTriple()).isSPIR() &&
"ITT annotations can only by added to a module with spir target");
"ITT annotations can only be added to a module with spir target");
PerModulePasses.add(createSPIRITTAnnotationsLegacyPass());
}

Expand Down Expand Up @@ -1479,6 +1479,15 @@ void EmitAssemblyHelper::RunOptimizationPipeline(
MPM.addPass(SYCLMutatePrintfAddrspacePass());
}

// Add SPIRITTAnnotations pass to the pass manager if
// -fsycl-instrument-device-code option was passed. This option can be used
// only with spir triple.
if (CodeGenOpts.SPIRITTAnnotations) {
assert(llvm::Triple(TheModule->getTargetTriple()).isSPIR() &&
"ITT annotations can only be added to a module with spir target");
MPM.addPass(SPIRITTAnnotationsPass());
}

// Allocate static local memory in SYCL kernel scope for each allocation
// call. It should be called after inlining pass.
if (LangOpts.SYCLIsDevice) {
Expand Down
3 changes: 2 additions & 1 deletion clang/test/CodeGenSYCL/kernel-simple-instrumentation.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/// Check if start/finish ITT annotations are being added during compilation of
/// SYCL device code

// RUN: %clang_cc1 -fsycl-is-device -fsycl-instrument-device-code -triple spir64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -fsycl-is-device -flegacy-pass-manager -fsycl-instrument-device-code -triple spir64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
// RUN: %clang_cc1 -fsycl-is-device -fno-legacy-pass-manager -fsycl-instrument-device-code -triple spir64-unknown-unknown -emit-llvm %s -o - | FileCheck %s

// CHECK: kernel_function
// CHECK-NEXT: entry:
Expand Down