[llvm] [AMDGPU] SelDAG: fix lowering of undefined workitem intrinsics (PR #126058)

Robert Imschweiler via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 7 03:15:39 PST 2025


================
@@ -8790,11 +8790,28 @@ SDValue SITargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
                              AMDGPUFunctionArgInfo::LDS_KERNEL_ID);
   }
   case Intrinsic::amdgcn_workitem_id_x:
-    return lowerWorkitemID(DAG, Op, 0, MFI->getArgInfo().WorkItemIDX);
+    if (!MFI->getArgInfo().WorkItemIDX) {
+      // It's undefined behavior if a function marked with the amdgpu-no-*
+      // attributes uses the corresponding intrinsic.
----------------
ro-i wrote:

I think I got the order of the handling of the different cases wrong or at least not like GlobalISel does it. I now adapted it to match the behavior of GlobalISel.

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


More information about the llvm-commits mailing list