[llvm] [SeparateConstOffsetFromGEP] Decompose constant xor operand if possible (PR #135788)

Sumanth Gundapaneni via llvm-commits llvm-commits at lists.llvm.org
Thu May 22 11:13:14 PDT 2025


sgundapa wrote:

> > Try to transform I = xor(A, C1) into or disjoint(Y, C2) where Y = xor(A, C0) is another existing instruction dominating I,
> > C2 = C1 - C0, and A is known to be disjoint with C2.
> 
> This transform also requires C0 and C2 to be disjoint, right? So `C2 = C1 - C0` can also be written as `C2 = C1 ^ C0`.

I have updated the description in a subsequent commit message. This is what I ended up with 
"Try to transform XOR(A, B+C) in to XOR(A,C) + B where XOR(A,C) becomes
the base for memory operations. This transformation is true under the
following conditions
Check 1 -  B and C are disjoint.
Check 2 - XOR(A,C) and B are disjoint"

I can check for A and B are disjointed as well, but check 1 and check 2  can deduce the same. 

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


More information about the llvm-commits mailing list