@@ -1745,7 +1745,7 @@ bool TargetLowering::SimplifyDemandedBits(
1745
1745
// aren't demanded (as above) and that the shifted upper c1 bits of
1746
1746
// x aren't demanded.
1747
1747
// TODO - support non-uniform vector amounts.
1748
- if (Op0. hasOneUse () && InnerOp.getOpcode () == ISD::SRL &&
1748
+ if (InnerOp.getOpcode () == ISD::SRL && Op0. hasOneUse () &&
1749
1749
InnerOp.hasOneUse ()) {
1750
1750
if (const APInt *SA2 =
1751
1751
TLO.DAG .getValidShiftAmountConstant (InnerOp, DemandedElts)) {
@@ -2375,18 +2375,18 @@ bool TargetLowering::SimplifyDemandedBits(
2375
2375
2376
2376
// If the input is only used by this truncate, see if we can shrink it based
2377
2377
// on the known demanded bits.
2378
- if (Src.getNode ()->hasOneUse ()) {
2379
- switch (Src.getOpcode ()) {
2380
- default :
2378
+ switch (Src.getOpcode ()) {
2379
+ default :
2380
+ break ;
2381
+ case ISD::SRL:
2382
+ // Shrink SRL by a constant if none of the high bits shifted in are
2383
+ // demanded.
2384
+ if (TLO.LegalTypes () && !isTypeDesirableForOp (ISD::SRL, VT))
2385
+ // Do not turn (vt1 truncate (vt2 srl)) into (vt1 srl) if vt1 is
2386
+ // undesirable.
2381
2387
break ;
2382
- case ISD::SRL:
2383
- // Shrink SRL by a constant if none of the high bits shifted in are
2384
- // demanded.
2385
- if (TLO.LegalTypes () && !isTypeDesirableForOp (ISD::SRL, VT))
2386
- // Do not turn (vt1 truncate (vt2 srl)) into (vt1 srl) if vt1 is
2387
- // undesirable.
2388
- break ;
2389
2388
2389
+ if (Src.getNode ()->hasOneUse ()) {
2390
2390
const APInt *ShAmtC =
2391
2391
TLO.DAG .getValidShiftAmountConstant (Src, DemandedElts);
2392
2392
if (!ShAmtC || ShAmtC->uge (BitWidth))
@@ -2408,8 +2408,8 @@ bool TargetLowering::SimplifyDemandedBits(
2408
2408
return TLO.CombineTo (
2409
2409
Op, TLO.DAG .getNode (ISD::SRL, dl, VT, NewTrunc, NewShAmt));
2410
2410
}
2411
- break ;
2412
2411
}
2412
+ break ;
2413
2413
}
2414
2414
2415
2415
assert (!Known.hasConflict () && " Bits known to be one AND zero?" );
0 commit comments