[clang] [CIR][SYCL] Emit attributes on the SYCL kernel caller (PR #224667)

Konstantinos Parasyris via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 18:46:56 PDT 2026


================
@@ -74,6 +74,24 @@ void CIRGenFunction::emitSYCLKernelCaller(
   eraseEmptyAndUnusedBlocks(funcOp);
 }
 
+static void setSYCLKernelAttributes(CIRGenFunction &cgf, cir::FuncOp fn) {
+  mlir::MLIRContext *ctx = &cgf.getMLIRContext();
+  // SYCL 2020 device language restrictions require forward progress and
+  // disallow recursion.
+  fn->setAttr(cir::CIRDialect::getNoRecurseAttrName(),
+              mlir::UnitAttr::get(ctx));
+  if (cgf.checkIfFunctionMustProgress())
+    fn->setAttr(cir::CIRDialect::getMustProgressAttrName(),
+                mlir::UnitAttr::get(ctx));
+}
+
+void CIRGenModule::addSYCLModuleIdAttr(cir::FuncOp fn) {
+  assert(getLangOpts().SYCLIsDevice);
+  StringRef moduleId = theModule.getSymName().value_or("");
----------------
koparasy wrote:

Good catch. Fixed.

https://github.com/llvm/llvm-project/pull/224667


More information about the cfe-commits mailing list