Hello!

Attached patch activates "safety net" recognition of pseudo regs for
LRA-enabled targets. LRA is able to spill pseudos to memory to satisfy
memory-only constraints, so constrain_operands should recognize this
functionality.

This is actually the same approach as how constants are handled a
couple of lines above. the changed section.

2015-03-18  Uros Bizjak  <ubiz...@gmail.com>

    PR rtl-optimization/60851
    * recog.c (constrain_operands): Accept a pseudo register before reload
    for LRA enabled targets.

testsuite/ChangeLog:

2015-03-18  Uros Bizjak  <ubiz...@gmail.com>

    PR rtl-optimization/60851
    * gcc.target/i386/pr60851.c: New test.

Patch was bootstrapped and regression tested on x86_64-linux-gnu {,-m32}.

OK for mainline and 4.9 branch?

Uros.
Index: recog.c
===================================================================
--- recog.c     (revision 221493)
+++ recog.c     (working copy)
@@ -2775,6 +2775,10 @@ constrain_operands (int strict, alternative_mask a
                               /* Before reload, accept what reload can turn
                                  into mem.  */
                               || (strict < 0 && CONSTANT_P (op))
+                              /* Before reload, accept a pseudo,
+                                 since LRA can turn it into mem.  */
+                              || (targetm.lra_p () && strict < 0 && REG_P (op)
+                                  && REGNO (op) >= FIRST_PSEUDO_REGISTER)
                               /* During reload, accept a pseudo  */
                               || (reload_in_progress && REG_P (op)
                                   && REGNO (op) >= FIRST_PSEUDO_REGISTER)))
Index: testsuite/gcc.target/i386/pr60851.c
===================================================================
--- testsuite/gcc.target/i386/pr60851.c (revision 0)
+++ testsuite/gcc.target/i386/pr60851.c (working copy)
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -flive-range-shrinkage -mtune=bdver4 
-mdispatch-scheduler" } */
+
+long double ld (char c)
+{
+  return c;
+}

Reply via email to