[TargetLowering] Respect recursive depth in SimplifyDemandedBits call to ComputeNumSignBits

This commit is contained in:
Simon Pilgrim 2020-01-26 10:01:21 +00:00
parent 66f93071cd
commit 4a5f9d9faf
1 changed files with 2 additions and 1 deletions

View File

@ -1629,7 +1629,8 @@ bool TargetLowering::SimplifyDemandedBits(
// If we only care about the highest bit, don't bother shifting right.
if (DemandedBits.isSignMask()) {
unsigned NumSignBits = TLO.DAG.ComputeNumSignBits(Op0);
unsigned NumSignBits =
TLO.DAG.ComputeNumSignBits(Op0, DemandedElts, Depth + 1);
bool AlreadySignExtended = NumSignBits >= BitWidth - ExVTBits + 1;
// However if the input is already sign extended we expect the sign
// extension to be dropped altogether later and do not simplify.