[llvm] [LLVM][CodeGen][AArch64] Increase opportunities to fold shift-of-extend into sshll/ushll. (PR #213989)

Ricardo Jesus via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 5 01:34:10 PDT 2026


================
@@ -8300,6 +8302,21 @@ void AArch64DAGToDAGISel::PreprocessISelDAG() {
     case AArch64ISD::CSEL:
       Result = tryFoldCselToFMaxMin(N);
       break;
+    case AArch64ISD::VSHL: {
+      SDValue LHS, RHS;
+      // Undo mul(shl(A,C),B) -> shl(mul(A,B),C) canonicalisation when A is an
+      // extend that can be folded into the shift.
+      if (sd_match(
+              N.getOperand(0),
+              m_Mul(m_Value(LHS, m_AnyOf(m_ZExt(m_Value()), m_SExt(m_Value()))),
----------------
rj-jesus wrote:

Should this also check that the mul is one-use?

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


More information about the llvm-commits mailing list