[llvm] [DAGCombine] Remove oneuse restrictions for RISCV in folding (shl (add_nsw x, c1)), c2) and folding (shl(sext(add x, c1)), c2) in some scenarios (PR #101294)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 1 20:52:36 PST 2024
================
@@ -18151,8 +18151,46 @@ bool RISCVTargetLowering::isDesirableToCommuteWithShift(
// (shl (or x, c1), c2) -> (or (shl x, c2), c1 << c2)
SDValue N0 = N->getOperand(0);
EVT Ty = N0.getValueType();
+
+ // LD/ST will optimize constant Offset extraction, so when AddNode is used by
+ // LD/ST, it can still complete the folding optimization operation performed
+ // above.
+ auto isLDST = [&]() {
----------------
topperc wrote:
This function name isn't great. Should it be `isUsedByLdSt`?
https://github.com/llvm/llvm-project/pull/101294
More information about the llvm-commits
mailing list