[llvm] [DAG] Fold mul 0 -> 0 when expanding mul into parts. (PR #168780)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 19 13:53:43 PST 2025
================
@@ -11096,10 +11095,14 @@ void TargetLowering::forceExpandMultiply(SelectionDAG &DAG, const SDLoc &dl,
// If HiLHS and HiRHS are set, multiply them by the opposite low part and add
// the products to Hi.
if (HiLHS) {
- Hi = DAG.getNode(ISD::ADD, dl, VT, Hi,
- DAG.getNode(ISD::ADD, dl, VT,
- DAG.getNode(ISD::MUL, dl, VT, HiRHS, LHS),
- DAG.getNode(ISD::MUL, dl, VT, RHS, HiLHS)));
+ Hi = DAG.getNode(
+ ISD::ADD, dl, VT, Hi,
+ DAG.getNode(
+ ISD::ADD, dl, VT,
+ isNullConstant(HiRHS) ? HiRHS
----------------
arsenm wrote:
Isn't there a simplify function you can call instead?
https://github.com/llvm/llvm-project/pull/168780
More information about the llvm-commits
mailing list