This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] Improve ComputeNumSignBits for SRem.
ClosedPublic

Authored by craig.topper on Feb 21 2021, 3:54 PM.

Details

Summary

The result will have the same sign as the dividend unless the
result is 0. The magnitude of the result will always be less
than or equal to the dividend. So the result will have at least
as many sign bits as the dividend.

Previously we would do this if the divisor was a positive constant,
but that isn't required.

Diff Detail

Event Timeline

craig.topper created this revision.Feb 21 2021, 3:54 PM
craig.topper requested review of this revision.Feb 21 2021, 3:54 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2021, 3:54 PM
RKSimon accepted this revision.Feb 22 2021, 1:59 PM

LGTM

This revision is now accepted and ready to land.Feb 22 2021, 1:59 PM
This revision was landed with ongoing or failed builds.Feb 22 2021, 2:36 PM
This revision was automatically updated to reflect the committed changes.