This is an archive of the discontinued LLVM Phabricator instance.

[KnownBits] Improve `KnownBits::udiv`
ClosedPublic

Authored by goldstein.w.n on May 7 2023, 11:57 PM.

Details

Summary

We can more precisely determine the upper bits doing `MaxNum /
MinDenum` as opposed to only using the MSB.

As well, if the exact flag is set, we can sometimes determine some
of the low-bits.

Diff Detail

Unit TestsFailed

Event Timeline

goldstein.w.n created this revision.May 7 2023, 11:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2023, 11:57 PM
goldstein.w.n requested review of this revision.May 7 2023, 11:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 7 2023, 11:57 PM
RKSimon accepted this revision.May 8 2023, 3:41 AM

LGTM with a couple of minors

llvm/lib/Support/KnownBits.cpp
604–605

Update comment?

616

Indentation

This revision is now accepted and ready to land.May 8 2023, 3:41 AM
goldstein.w.n marked 2 inline comments as done.May 13 2023, 10:53 AM
This revision was landed with ongoing or failed builds.May 16 2023, 4:59 PM
This revision was automatically updated to reflect the committed changes.
foad added inline comments.May 18 2023, 2:47 AM
llvm/lib/Support/KnownBits.cpp
614–626

Common this up with the identical logic in sdiv?