[llvm] [DAG] Fold mul 0 -> 0 when expanding mul into parts. (PR #168780)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 19 14:48:09 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
----------------
topperc wrote:
What's the impact if we had a zero check to getNode like we do for ISD::AND/OR/XOR/ADD/SUB?
https://github.com/llvm/llvm-project/pull/168780
More information about the llvm-commits
mailing list