[llvm] [RISCV] Expand constant multiplication for targets without M extension (PR #137195)

Iris Shi via llvm-commits llvm-commits at lists.llvm.org
Thu May 8 21:15:51 PDT 2025


================
@@ -15531,20 +15631,23 @@ static SDValue expandMul(SDNode *N, SelectionDAG &DAG,
   if (DAG.getMachineFunction().getFunction().hasMinSize())
     return SDValue();
 
-  if (DCI.isBeforeLegalize() || DCI.isCalledByLegalizer())
-    return SDValue();
-
   if (VT != Subtarget.getXLenVT())
     return SDValue();
 
-  const bool HasShlAdd =
-      Subtarget.hasStdExtZba() || Subtarget.hasVendorXTHeadBa();
-
   ConstantSDNode *CNode = dyn_cast<ConstantSDNode>(N->getOperand(1));
   if (!CNode)
     return SDValue();
   uint64_t MulAmt = CNode->getZExtValue();
 
+  if (!Subtarget.hasStdExtM() && !Subtarget.hasStdExtZmmul())
----------------
el-ev wrote:

The `DCI.isBeforeLegalize() || DCI.isCalledByLegalizer()` guard is not added by me, and I'm not sure how to deal with it.

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


More information about the llvm-commits mailing list