[llvm] [DAG] Fold mul 0 -> 0 when expanding mul into parts. (PR #168780)
David Green via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 20 09:12:29 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
----------------
davemgreen wrote:
Yeah, see the first patch in the series. I will see about fixing the issues that went wrong doing it that way.
https://github.com/llvm/llvm-project/pull/168780
More information about the llvm-commits
mailing list