https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101882
--- Comment #20 from Segher Boessenkool <segher at gcc dot gnu.org> --- (In reply to Peter Bergner from comment #17) > The reason operands 0, 1 and 4 all use the register r23, is that each > operand is using the same pseudo, coming from variable "x", which is a user > defined hard register: > > register long x asm ("s0"); So, user error. > It does seem wrong that combine succeeded in combining those patterns, but > as Segher mentioned, it's recog() that said it was "ok". Yes, combine has nothing to do with this (as usual whenever combine is blamed!) > (In reply to Segher Boessenkool from comment #16) > > It is allowed by recog(). Most likely your pattern is incorrect, but it > > is not completely impossible there is something wrong in genrecog.cc -- > > but that isn't combine either. > > Does recog() not check for early clobber when run before RA? It does not care at all if anything is a hard reg or a pseudo, nor if any pseudos still exist ("RA has not yet run"). > Or does it > assume a pseudo cannot early clobber itself? It does not assume such things, no. In very many (older) backends many pseudos are written to multiple times (and not just on the branches of a diamond either). That just makes it hard (or impossible) for RA to do a good job (or to do its job at all), and it makes combine a lot less effective, etc.; SSA form is good form! But anything valid is valid.