[llvm] KnownBits: refine high-bits of mul in signed case (PR #113051)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 22 09:58:06 PDT 2024
artagnon wrote:
> I'd prefer to put the ad hoc tests in `unittests/Support/KnownBitsTest.cpp` since it's a more direct way of testing the KnownBits implementation than going via ValueTracking.
I'm not sure we'd want to pollute the unit tests with ad-hoc tests: to me, KnownBitsTest.cpp is a collection of disciplined tests that should never fail. We already have several knownbits-*.ll in ValueTracking/test, and I think adding knownbits-mul.ll works in practice, as long as we pre-commit a reduced test, show non-reduction, and show a reduction after the patch.
> For future work: I suspect that what you have implemented here is not quite optimal for the high bits. We could fix that and extend #113316 to check optimality of high bits as well as low bits.
I also suspect that it's not optimal for high bits: I think we need some logic similar to the low-bits logic later in the function. Will think about a follow-up when I have some free time, if you don't beat me to it first.
https://github.com/llvm/llvm-project/pull/113051
More information about the llvm-commits
mailing list