[llvm] [InstCombine] ptrmask of gep for dynamic pointer aligment (PR #80002)

Jon Chesterfield via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 12 14:55:47 PST 2024


JonChesterfield wrote:

Now uses computeknownbits on the gep pointer argument instead of checking alignment, added the test cases and checked previous ones are unchanged.

As written it could be extended - non-i8 gep types, vector types. Strictly speaking it's not only adding a constant to zero low bits that can be removed either - various combinations of known bits on the input and a constant gep can be combined with the subsequent mask and simplified. Since gep of i8 is essentially add with an implicit ptrtoint.

I think this is useful as a standalone improvement without that additional complexity.

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


More information about the llvm-commits mailing list