[clang] [HLSL] Apply NoRecurse attrib to all HLSL functions (PR #105907)

David Peixotto via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 09:27:43 PDT 2024


================
@@ -1064,13 +1064,17 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy,
   // OpenCL C 2.0 v2.2-11 s6.9.i:
   //     Recursion is not supported.
   //
+  // HLSL
+  //     Recursion is not supported.
+  //
   // SYCL v1.2.1 s3.10:
   //     kernels cannot include RTTI information, exception classes,
   //     recursive code, virtual functions or make use of C++ libraries that
   //     are not compiled for the device.
-  if (FD && ((getLangOpts().CPlusPlus && FD->isMain()) ||
-             getLangOpts().OpenCL || getLangOpts().SYCLIsDevice ||
-             (getLangOpts().CUDA && FD->hasAttr<CUDAGlobalAttr>())))
+  if (FD &&
+      ((getLangOpts().CPlusPlus && FD->isMain()) || getLangOpts().OpenCL ||
+       getLangOpts().HLSL || getLangOpts().SYCLIsDevice ||
----------------
dmpots wrote:

Does the `norecurse` attribute apply to direct recursion only or indirectly as well (e.g. `A->B->A`). We do have bounded recursion in raytracing in that `TraceRay` can invoke a `ClosetHit` shader which can then again call `TraceRay`.

I don't think that changes anything about this PR, but just throwing it out there in case it matters.

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


More information about the cfe-commits mailing list