[llvm] [LV] Add vplan folds for (X - (X & Y)) -> (X & ~Y) (PR #226466)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 28 03:58:10 PDT 2026


david-arm wrote:

Hi @lukel97, the problem here is simpler than I thought. The key thing that vplan is missing is analysis to compute known bits for input operands in instructions like `%and = and i64 %zext, 31`. It looks like instcombine is able to prove that the bottom 5 bits of `%zext` are 5 (due to the `%shl` and the `%or`) and is therefore able to simply fold the whole instruction into the constant `5`.

My only conclusion here is that this PR is simply not viable without reimplementing computeKnownBits for the Nth time in vplan. I also don't think that's a path we want to go down, since ValueTracking.cpp is a pretty huge file. :)

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


More information about the llvm-commits mailing list