On 13-04-11 12:51 PM, Uros Bizjak wrote:
On Wed, Apr 10, 2013 at 10:15 PM, Vladimir Makarov <vmaka...@redhat.com> wrote:
The following patch fixes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56903

In this test case reload pass gets correct value HARD_REGNO_MODE_OK because
it can not create pseudos (can_create_pseudo) and this was actually used
that we are in reload (or after reload).  LRA can create pseudos therefore
it got the wrong answer.  The patch fixes it.
Actually, the problem was with *lea_general_2 that allows QImode
values in non-QImode registers. This is OK, since these registers will
be split to paradoxical SImode registers and handled with lea insn.
Apparently, LRA checks if registers can hold this mode through
ix86_hard_regno_mode_ok, which fails in this particular case. BTW:
there are many insn where QImode can live in non-QImode reg, e.g. the
last alternative of *addqi_1, and similar insn patterns, that are
split to lea after reload.

The proposed patch is OK, although I'd propose to change it a bit with
a more descriptive comment:

        if (!TARGET_PARTIAL_REG_STALL)
         return true;
+      /* LRA checks if the hard register is OK for the given mode.
+        QImode values can live in non-QI regs, so we
+        allow all registers here.  */
+      if (lra_in_progress)
+       return true;
        return !can_create_pseudo_p ();


2013-04-10  Vladimir Makarov  <vmaka...@redhat.com>

         PR tree-optimization/56903
This is target issue, so PR target/56903.

         * config/i386/i386.c (ix86_hard_regno_mode_ok): Add
         lra_in_progress for return.

2013-04-10  Vladimir Makarov  <vmaka...@redhat.com>

         PR tree-optimization/56903
And here.

         * gcc.target/i386/pr56903.c: New test.


OK for the trunk?

The patch is OK with these changes for mainline and 4.8 branch.


Thanks. Committed with your proposals as rev. 197927 (trunk) and 197928 (4.8 branch).

Reply via email to