[llvm] [AArch64] Allow folding between CMN and ADDS and other flag setting nodes are commutative (PR #160170)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 23 03:35:30 PDT 2025


================
@@ -25841,6 +25841,13 @@ static SDValue narrowExtractedVectorBinOp(EVT VT, SDValue Src, unsigned Index,
   if (WideNumElts % NarrowingRatio != 0)
     return SDValue();
 
+  // Bail out if the binop has different element types between operands and
+  // result. This prevents incorrect transforms for ops like PMULL where result
+  // element type differs from operand element types.
+  if (BinOp.getOperand(0).getValueType().getScalarType() !=
+      WideBVT.getScalarType())
+    return SDValue();
----------------
RKSimon wrote:

We make a lot of assumptions that binops have consistent types - I'm concerned that this might not be the only place this needs addressing - maybe drop this and the MULL handling for now?

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


More information about the llvm-commits mailing list