[llvm] [AMDGPU] Reject illegal image atomic data widths in SelectionDAG (PR #210366)

Arseniy Obolenskiy via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 19 08:46:36 PDT 2026


================
@@ -10373,6 +10373,24 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
          IntrOpcode == AMDGPU::IMAGE_ATOMIC_PK_ADD_BF16 ||
          IntrOpcode == AMDGPU::IMAGE_ATOMIC_PK_ADD_BF16_NORTN);
 
+    if (!IsAtomicPacked16Bit && VData.getValueSizeInBits() != 32 &&
+        VData.getValueSizeInBits() != 64) {
+      DAG.getContext()->diagnose(DiagnosticInfoUnsupported(
+          DAG.getMachineFunction().getFunction(),
+          "unsupported image atomic data type", DL.getDebugLoc()));
+
+      unsigned Idx = 0;
+      SmallVector<SDValue, 3> RetValues(OrigResultTypes.size());
+      for (EVT VT : OrigResultTypes) {
+        if (VT == MVT::Other)
+          RetValues[Idx++] = Op.getOperand(0); // Chain
+        else
+          RetValues[Idx++] = DAG.getPOISON(VT);
+      }
+
+      return DAG.getMergeValues(RetValues, DL);
----------------
aobolensk wrote:

Done

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


More information about the llvm-commits mailing list