[llvm] [InstCombine] Fold (X / C) < X and (X >> C) < X into X > 0 (PR #85555)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Mar 17 13:05:20 PDT 2024
goldsteinn wrote:
> Yeah, that merge was an accident, I'll remove it before pushing the most recent changes. It seems to me like handling `ashr` would just unnecessarily increase the complexity of the code without providing significant benefit, so I'll omit it. The only question I have now is whether I should add tests for all three instructions I'm working with and all 10 (or 6) comparison predicates, making it 26 tests in total, which, together with negative tests, will bring it closer to 30, or should I simply test 2-3 predicates for each of the three instructions?
So generally you should be testing different control flows moreso than code.
In this case you have all predicates have the same control flow for `lshr`/`udiv`, so maybe between the two test one equality pred, one signed, and one unsigned (i.e eq, sle, ugt). Then a negative test for each maybe with an out of bounds constant.
For `sdiv` maybe ne / sgt with two negative tests (out of bounds/unsigned pred).
Then you can pretty randomly make 1-2 of the tests use vec.
Please be sure to have a negative test with a vec where one vec element is invalid and the other is valid.
https://github.com/llvm/llvm-project/pull/85555
More information about the llvm-commits
mailing list