Alive2: https://alive2.llvm.org/ce/z/_J5q3S
Closes: https://github.com/llvm/llvm-project/issues/60957
Signed-off-by: Jun Zhang <jun@junz.org>
Differential D144777
[InstCombine] Fold signbit test of a pow2 or zero junaire on Feb 24 2023, 10:28 PM. Authored by
Details Alive2: https://alive2.llvm.org/ce/z/_J5q3S Signed-off-by: Jun Zhang <jun@junz.org>
Diff Detail
Unit Tests Event Timeline
Comment Actions Please can you add vector test coverage?
Comment Actions Hi @spatel, thanks for your comments, I updated the tests according to your Can you take a look? Is this because I missed something? Or my fold pattern is wrong. Comment Actions There shouldn't be any extra instruction between the sub (negate) and and. You just need one extra binary-op instruction to create "%x", so it stays operand 0 of the and. You don't need any extra instructions if you want "%x" to be operand 1. I think it would be better to add the transform inside of InstCombinerImpl::foldICmpAndConstant().
Comment Actions Thanks for your comments, they are very helpful. I pushed an NFC change about the recommit test in https://github.com/llvm/llvm-project/commit/cf491a165f239abfa7ab9e707f5cbd1861a6cb20 and moved the fold pattern to the place you suggest. Please take a look :) Comment Actions We should have 2 more tests: (1) extra use of the sub and (2) extra use of the and.
Comment Actions Reuse existing code and add more tests. Just a beginer to the middle-end so bear with me if I get things wrong!
Comment Actions LGTM - thanks!
Comment Actions Thanks to everyone who helped me review the patch! My first contribution to the optimization world, nice! |
"CI" should be "MinSignedC" or something like that in these comments and the code to be more specific.