[llvm] [SelectionDAG] Let ComputeKnownSignBits handle (shl (ext X), C) (PR #97695)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 5 03:21:05 PDT 2024
================
@@ -4615,12 +4615,30 @@ unsigned SelectionDAG::ComputeNumSignBits(SDValue Op, const APInt &DemandedElts,
Tmp = std::min<uint64_t>(Tmp + *ShAmt, VTBits);
return Tmp;
case ISD::SHL:
- if (std::optional<uint64_t> ShAmt =
+ if (std::optional<uint64_t> MaxShAmt =
getValidMaximumShiftAmount(Op, DemandedElts, Depth + 1)) {
+ if (Op.getOperand(0).getOpcode() == ISD::ANY_EXTEND ||
+ Op.getOperand(0).getOpcode() == ISD::ZERO_EXTEND ||
+ Op.getOperand(0).getOpcode() == ISD::SIGN_EXTEND)
+ if (std::optional<uint64_t> MinShAmt =
+ getValidMinimumShiftAmount(Op, DemandedElts, Depth + 1)) {
+ SDValue Src = Op.getOperand(0);
+ EVT SrcVT = Src.getValueType();
+ SDValue ExtendedOp = Op.getOperand(0).getOperand(0);
+ EVT ExtendedOpVT = ExtendedOp.getValueType();
----------------
RKSimon wrote:
(pedantic) ExtendedOp isn't extended - it's the pre-extended source value
https://github.com/llvm/llvm-project/pull/97695
More information about the llvm-commits
mailing list