[llvm] KnownBits: refine high-bits of mul in signed case (PR #113051)

Jay Foad via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 23 01:14:06 PDT 2024


jayfoad 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.

There's no question of "pollution". It's the correct place for KnownBits tests. Yes we have tried to make most of the existing tests "disciplined" and exhaustive, but ad hoc tests can go in there too. They also have the advantage that it's much more obvious what cases are being tested - you don't have to craft IR with `and`s and `or`s to persuade ValueTracking to create the KnownBits objects you want to test.

https://github.com/llvm/llvm-project/pull/113051


More information about the llvm-commits mailing list