[llvm] [InstCombine] Decompose constant xor operand if possible (PR #147599)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 03:37:30 PDT 2025


https://github.com/nikic commented:

Hm, I don't think that this transform is a good fit for InstCombine. Converting `x ^ c1` into `(x ^ c2) | c1` seems like a less canonical form, as it increases the dependence distance. My baseline expectation would be that InstCombine does the fold in the reverse direction.

As far as I understand, this fold is only actually beneficial if the new form can be folded into a GEP offset. I think you need to only handle that case in particular. But even then I'm not sure that InstCombine is the right place for it (rather than the backend).

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


More information about the llvm-commits mailing list