Can figure out some of the upper bits (similiar to udiv) if we know
the sign of the inputs.
As well, if we have the exact flag we can sometimes determine some
low-bits.
Paths
| Differential D150093
[KnownBits] Add implementation for `KnownBits::sdiv` ClosedPublic Authored by goldstein.w.n on May 7 2023, 11:57 PM.
Details Summary Can figure out some of the upper bits (similiar to udiv) if we know As well, if we have the exact flag we can sometimes determine some
Diff Detail
Event Timelinegoldstein.w.n added a child revision: D150094: [KnownBits] Improve `KnownBits::udiv`.May 8 2023, 12:01 AM goldstein.w.n added a parent revision: D150092: [ValueTracking] Add tests for knownbits of `sdiv` and `udiv`; NFC. Comment Actions FWIW, if we know the sign bits of sdiv, we should really always be converting it to udiv. We actually already do this in CVP, and should also implement the same in InstCombine. It currently only handles the non-negative case, but the others can be implemented by adding the necessary negations. Comment Actions
I saw that. It increases instruction count though. It's also hard to undo in the backend and results in worse codegen. I was planning to make a patch to actually stop doing it for non-constant operands because of that. This revision is now accepted and ready to land.May 13 2023, 4:04 AM Closed by commit rG8c569c922bc5: [KnownBits] Add implementation for `KnownBits::sdiv` (authored by goldstein.w.n). · Explain WhyMay 16 2023, 4:58 PM This revision was automatically updated to reflect the committed changes. Comment Actions Sorry I'm late.
Comment Actions
Shoot, this has already been pushed. Would you like me to create a follow up patch? (likewise for the udiv patch). Comment Actions
Sure, unless you think the changes are trivial enough not to need (pre-commit) review. Comment Actions
Just FYI, on matters of process: Comment Actions
Created D150921, D150922, and D150923 think addressed all your concerns except the ones explicitly commented there.
Revision Contents
Diff 520562 llvm/include/llvm/Support/KnownBits.h
llvm/lib/Support/KnownBits.cpp
llvm/unittests/Support/KnownBitsTest.cpp
|
Typo "Equivalent"