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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 13 09:50:33 PDT 2025


nikic wrote:

> Thanks for reviewing @nikic. I have originally attempted to do this here #135788, and was directed to give a try in InstCombine. Would it make sense if I restrict the transformation to just GEPs. What I am really after is folding these xor computations in to GEPs, so that I do not have to recompute address for each of the loads (referring to the attached test in the patch).

If we restrict this to GEPs, I think this would be fine. My reasoning would be that an address with a xor offset is basically unanalyzable, while constant GEPs from a common base are analyzable. As such, this seems beneficial to do already in the middle-end, rather than the backend.

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


More information about the llvm-commits mailing list