https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55212
--- Comment #162 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Kazumoto Kojima from comment #153) > Created attachment 58886 [details] > a revised patch for c#135 and c#139 > > (In reply to Oleg Endo from comment #139) > > If we try to keep the old behavior with -mno-lra as possible, it means that > when we define new patterns with R0-clobber, they should be guarded with > sh_lra_p() rigidly and the old patterns should be kept. > The patch adds these guards to the new patterns in c#135 and fixes the > testcase 58859. I'm not in favor of the R0-clobber approach, to be honest. I think we would need to add it to the other R0-restricted insns as well. I'm also afraid of code quality getting worse if we add all those R0-clobbers everywhere. With LRA we are already getting worse code quality than before, so this will just make it even worse. Then there is the maintenance overhead. So if we use this approach, it's probably best to make it LRA-only. Obviously, the spill failure issues are a problem of LRA. I hope that they can be addressed adequately by LRA maintainers in time, before forcing everybody to switch to LRA. If this doesn't happen, we could also hide R0 from register allocation and fix it up using an SH specific RTL post-register-allocation pass to "optimize the R0 usage". I think this idea has been around for a while, it's just again quite a bit of work.