https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90007

--- Comment #11 from Vladimir Makarov <vmakarov at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #4)
> Well, often sel-sched just does not discriminate hardregs and pseudos when
> checking if renaming/substitution may be applied. Sure, as a matter of
> efficiency we should probably disallow substitution through such mixed
> pseudo=hardreg assignments.
> 
> Nevertheless, if it's not only a matter of optimization, but also of
> internal consistency, then I'd like to understand it better. Hence the
> question in comment #2.

Alexander, it is a legitimate question.

LRA changed actively during many years and LRA now can reload hard register as
pseudo register into memory.  Unfortunately, recog.c was not adapted to these
changes.

I think the following patch will reflect the LRA changes:

Index: recog.c
===================================================================
--- recog.c     (revision 278413)
+++ recog.c     (working copy)
@@ -2757,10 +2757,9 @@ constrain_operands (int strict, alternat
                               /* Before reload, accept what reload can turn
                                  into a mem.  */
                               || (strict < 0 && CONSTANT_P (op))
-                              /* Before reload, accept a pseudo,
+                              /* Before reload, accept a pseudo or hard
register,
                                  since LRA can turn it into a mem.  */
-                              || (strict < 0 && targetm.lra_p () && REG_P (op)
-                                  && REGNO (op) >= FIRST_PSEUDO_REGISTER)
+                              || (strict < 0 && targetm.lra_p () && REG_P
(op))
                               /* During reload, accept a pseudo  */
                               || (reload_in_progress && REG_P (op)
                                   && REGNO (op) >= FIRST_PSEUDO_REGISTER)))

I've checked the patch.  It solves the problem.  I'll submit it for approval
after testing, probably tomorrow.

Reply via email to