[llvm] [AMDGPU] Fix FDOT2 fold for non-constant lane indices (PR #217646)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 20 11:14:17 PDT 2026


================
@@ -18365,9 +18365,11 @@ SDValue SITargetLowering::performFMACombine(SDNode *N,
     SDValue Vec4 = FMAOp2.getOperand(0);
     SDValue Idx2 = FMAOp1.getOperand(1);
 
-    if (Idx1 != Op2.getOperand(1) || Idx2 != FMAOp2.getOperand(1) ||
-        // Idx1 and Idx2 cannot be the same.
-        Idx1 == Idx2)
+    if (Idx1 != Op2.getOperand(1) || Idx2 != FMAOp2.getOperand(1))
+      return SDValue();
+
+    if (!isa<ConstantSDNode>(Idx1) || !isa<ConstantSDNode>(Idx2) ||
+        Op1.getConstantOperandVal(1) == FMAOp1.getConstantOperandVal(1))
----------------
arsenm wrote:

I think the constant value check is redundant 

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


More information about the llvm-commits mailing list