https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95632
--- Comment #3 from Jim Wilson <wilson at gcc dot gnu.org> --- It isn't possible to have patterns that match only in combine. If we add a pattern to accept (xor (reg) (large constant)) then it could match in any optimization pass, and could prevent us from optimizing away redundant lui instructions. There is a representation issue here with constants. If we split them early, then optimizing redundant lui is easy. If we split them late, then optimizing redundant lui is hard. There are also other optimizations that may be easy or hard depending on whether constants are split early or late. Currently, we always split constants early, and changing that will have a major impact on the code optimization, which may be good or bad, but more likely will be good for some programs and bad for others. I'd rather not change this as it will be a major project to deal with the problems caused by the change. Hence my suggestion at RTL generation time to split xor with constants differently. I have a proof of concept patch for that, but it needs a lot of cleanup to be useful, and a lot of testing to verify that it improves code more often than it harms code. As for ree, splitters after register allocation traditionally check reload_completed which is a global variable set near the end of the last register allocation pass. The split2 pass happens between reload and ree. Maybe moving ree before split2 would help RISC-V, but might hurt other targets. Or might help for some programs and hurt for others.