[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)
Min-Yih Hsu via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 1 14:23:54 PDT 2024
================
@@ -19137,3 +19138,20 @@ Value *PPCTargetLowering::emitMaskedAtomicCmpXchgIntrinsic(
return Builder.CreateOr(
Lo, Builder.CreateShl(Hi, ConstantInt::get(ValTy, 64)), "val64");
}
+
+bool PPCTargetLowering::isDesirableToCommuteWithShift(
+ const SDNode *N, CombineLevel Level) const {
+ using namespace llvm::SDPatternMatch;
+ assert((N->getOpcode() == ISD::SHL || N->getOpcode() == ISD::SRA ||
+ N->getOpcode() == ISD::SRL) &&
+ "Expected shift op");
+
+ SDValue ShiftLHS = N->getOperand(0);
+ SDValue Add;
+
+ if (ShiftLHS->hasOneUse() ||
----------------
mshockwave wrote:
ditto
https://github.com/llvm/llvm-project/pull/101294
More information about the llvm-commits
mailing list