@@ -797,7 +797,7 @@ SDValue TargetLowering::SimplifyMultipleUseDemandedBits(
797
797
// If we are only demanding sign bits then we can use the shift source
798
798
// directly.
799
799
if (std::optional<uint64_t > MaxSA =
800
- DAG.getValidMaximumShiftAmount (Op, DemandedElts, Depth)) {
800
+ DAG.getValidMaximumShiftAmount (Op, DemandedElts, Depth + 1 )) {
801
801
SDValue Op0 = Op.getOperand (0 );
802
802
unsigned ShAmt = *MaxSA;
803
803
unsigned NumSignBits =
@@ -1737,7 +1737,7 @@ bool TargetLowering::SimplifyDemandedBits(
1737
1737
EVT ShiftVT = Op1.getValueType ();
1738
1738
1739
1739
if (std::optional<uint64_t > KnownSA =
1740
- TLO.DAG .getValidShiftAmount (Op, DemandedElts, Depth)) {
1740
+ TLO.DAG .getValidShiftAmount (Op, DemandedElts, Depth + 1 )) {
1741
1741
unsigned ShAmt = *KnownSA;
1742
1742
if (ShAmt == 0 )
1743
1743
return TLO.CombineTo (Op, Op0);
@@ -1749,7 +1749,7 @@ bool TargetLowering::SimplifyDemandedBits(
1749
1749
if (Op0.getOpcode () == ISD::SRL) {
1750
1750
if (!DemandedBits.intersects (APInt::getLowBitsSet (BitWidth, ShAmt))) {
1751
1751
if (std::optional<uint64_t > InnerSA =
1752
- TLO.DAG .getValidShiftAmount (Op0, DemandedElts, Depth + 1 )) {
1752
+ TLO.DAG .getValidShiftAmount (Op0, DemandedElts, Depth + 2 )) {
1753
1753
unsigned C1 = *InnerSA;
1754
1754
unsigned Opc = ISD::SHL;
1755
1755
int Diff = ShAmt - C1;
@@ -1789,7 +1789,7 @@ bool TargetLowering::SimplifyDemandedBits(
1789
1789
if (InnerOp.getOpcode () == ISD::SRL && Op0.hasOneUse () &&
1790
1790
InnerOp.hasOneUse ()) {
1791
1791
if (std::optional<uint64_t > SA2 = TLO.DAG .getValidShiftAmount (
1792
- InnerOp, DemandedElts, Depth + 1 )) {
1792
+ InnerOp, DemandedElts, Depth + 2 )) {
1793
1793
unsigned InnerShAmt = *SA2;
1794
1794
if (InnerShAmt < ShAmt && InnerShAmt < InnerBits &&
1795
1795
DemandedBits.getActiveBits () <=
@@ -1918,7 +1918,7 @@ bool TargetLowering::SimplifyDemandedBits(
1918
1918
// If we are only demanding sign bits then we can use the shift source
1919
1919
// directly.
1920
1920
if (std::optional<uint64_t > MaxSA =
1921
- TLO.DAG .getValidMaximumShiftAmount (Op, DemandedElts, Depth)) {
1921
+ TLO.DAG .getValidMaximumShiftAmount (Op, DemandedElts, Depth + 1 )) {
1922
1922
unsigned ShAmt = *MaxSA;
1923
1923
unsigned NumSignBits =
1924
1924
TLO.DAG .ComputeNumSignBits (Op0, DemandedElts, Depth + 1 );
@@ -1934,7 +1934,7 @@ bool TargetLowering::SimplifyDemandedBits(
1934
1934
EVT ShiftVT = Op1.getValueType ();
1935
1935
1936
1936
if (std::optional<uint64_t > KnownSA =
1937
- TLO.DAG .getValidShiftAmount (Op, DemandedElts, Depth)) {
1937
+ TLO.DAG .getValidShiftAmount (Op, DemandedElts, Depth + 1 )) {
1938
1938
unsigned ShAmt = *KnownSA;
1939
1939
if (ShAmt == 0 )
1940
1940
return TLO.CombineTo (Op, Op0);
@@ -1946,7 +1946,7 @@ bool TargetLowering::SimplifyDemandedBits(
1946
1946
if (Op0.getOpcode () == ISD::SHL) {
1947
1947
if (!DemandedBits.intersects (APInt::getHighBitsSet (BitWidth, ShAmt))) {
1948
1948
if (std::optional<uint64_t > InnerSA =
1949
- TLO.DAG .getValidShiftAmount (Op0, DemandedElts, Depth + 1 )) {
1949
+ TLO.DAG .getValidShiftAmount (Op0, DemandedElts, Depth + 2 )) {
1950
1950
unsigned C1 = *InnerSA;
1951
1951
unsigned Opc = ISD::SRL;
1952
1952
int Diff = ShAmt - C1;
@@ -2041,7 +2041,7 @@ bool TargetLowering::SimplifyDemandedBits(
2041
2041
return TLO.CombineTo (Op, TLO.DAG .getNode (ISD::SRL, dl, VT, Op0, Op1));
2042
2042
2043
2043
if (std::optional<uint64_t > KnownSA =
2044
- TLO.DAG .getValidShiftAmount (Op, DemandedElts, Depth)) {
2044
+ TLO.DAG .getValidShiftAmount (Op, DemandedElts, Depth + 1 )) {
2045
2045
unsigned ShAmt = *KnownSA;
2046
2046
if (ShAmt == 0 )
2047
2047
return TLO.CombineTo (Op, Op0);
@@ -2050,7 +2050,7 @@ bool TargetLowering::SimplifyDemandedBits(
2050
2050
// supports sext_inreg.
2051
2051
if (Op0.getOpcode () == ISD::SHL) {
2052
2052
if (std::optional<uint64_t > InnerSA =
2053
- TLO.DAG .getValidShiftAmount (Op0, DemandedElts, Depth + 1 )) {
2053
+ TLO.DAG .getValidShiftAmount (Op0, DemandedElts, Depth + 2 )) {
2054
2054
unsigned LowBits = BitWidth - ShAmt;
2055
2055
EVT ExtVT = EVT::getIntegerVT (*TLO.DAG .getContext (), LowBits);
2056
2056
if (VT.isVector ())
@@ -2596,7 +2596,7 @@ bool TargetLowering::SimplifyDemandedBits(
2596
2596
2597
2597
if (Src.getNode ()->hasOneUse ()) {
2598
2598
std::optional<uint64_t > ShAmtC =
2599
- TLO.DAG .getValidShiftAmount (Src, DemandedElts, Depth + 1 );
2599
+ TLO.DAG .getValidShiftAmount (Src, DemandedElts, Depth + 2 );
2600
2600
if (!ShAmtC || *ShAmtC >= BitWidth)
2601
2601
break ;
2602
2602
uint64_t ShVal = *ShAmtC;
0 commit comments