[llvm] [DAG] Remove OneUse restriction when folding (shl (add x, c1), c2) (PR #69105)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 16 10:01:01 PDT 2023
================
@@ -10035,7 +10035,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)) {
+ TLI.isDesirableToCommuteWithShift(N, Level)) {
----------------
goldsteinn wrote:
Simpler might be to make `TLI.isDesirableToComputeWithShift` return an enum s.t based on return its either:
1. Always preferable
2. Preferable if one use
3. Never preferable
Then you can just leave the 1-use check here as opposed to putting it in each backend.
https://github.com/llvm/llvm-project/pull/69105
More information about the llvm-commits
mailing list