[llvm] [DAG] Remove OneUse restriction when folding (shl (add x, c1), c2) (PR #101294)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 31 01:39:20 PDT 2024


================
@@ -10070,7 +10070,7 @@ SDValue DAGCombiner::visitSHL(SDNode *N) {
   // Variant of version done on multiply, except mul by a power of 2 is turned
   // into a shift.
   if ((N0.getOpcode() == ISD::ADD || N0.getOpcode() == ISD::OR) &&
-      N0->hasOneUse() && TLI.isDesirableToCommuteWithShift(N, Level)) {
----------------
arsenm wrote:

How is this beneficial if you have to duplicate the inner add? 

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


More information about the llvm-commits mailing list