[InstCombine] SimplifyDemandedUseBits - add TODO to remove shl node if we only demand known sign bits of the shift source

Similar to what we already perform for ashr/lshr
This commit is contained in:
Simon Pilgrim 2022-04-07 14:35:11 +01:00
parent 5e90224839
commit 5909c67883
1 changed files with 3 additions and 0 deletions

View File

@ -563,6 +563,9 @@ Value *InstCombinerImpl::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
DemandedMask, Known))
return R;
// TODO: If we only want bits that already match the signbit then we don't
// need to shift.
uint64_t ShiftAmt = SA->getLimitedValue(BitWidth-1);
APInt DemandedMaskIn(DemandedMask.lshr(ShiftAmt));