[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:27:12 PST 2024


AtariDreams wrote:

_Bytes = _Bytes & ~(_Align - 1); Is a common idiom for rounding up to the nearest alignment.
Difference = Bytes & (_Align - 1) is used to get the modulo.

subtracting these values is useful if you want to know the difference if say, _Bytes were to be the size of a buffer for example.



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


More information about the llvm-commits mailing list