[llvm] [DAG] Reassociate (add (add X, Y), X) --> add(shl(X, 1), Y) (PR #162242)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 2 04:53:23 PDT 2026
================
@@ -2978,6 +2978,17 @@ SDValue DAGCombiner::visitADDLike(SDNode *N) {
if (SDValue RADD = reassociateOps(ISD::ADD, DL, N0, N1, N->getFlags()))
return RADD;
+ // (X + Y) + X --> Y + (X << 1)
----------------
RKSimon wrote:
Yes, sorry I'm just playing with the draft at the moment - I'd forgotten I'd added you as reviewers
https://github.com/llvm/llvm-project/pull/162242
More information about the llvm-commits
mailing list