[llvm] [InstCombine] Fold (A & B) - (A & ~B) --> B - (A ^ B) (PR #79717)

via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 7 13:13:03 PST 2024


AtariDreams wrote:

> Did you encounter this pattern in real-world code?

Yes: X & -(alignment - 1) is a common way to align. X & (alignment - 1) is a common way to get the lower bits starting from alignment and lower.

By subtracting these two, you get how much is between X and X rounded to alignment.

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


More information about the llvm-commits mailing list