The following patch fixes

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

The patch was bootstrapped on x86/x86-64 and arm and tested on x86/x86-64.

Unfortunately I did not managed to decrease the test significantly to include it into the testsuite.

Committed as rev. 210828 into the trunk and rev. 210829 into the gcc-4.9 branch.

  2014-05-22  Vladimir Makarov  <vmaka...@redhat.com>

        PR rtl-optimization/61215
        * lra-elelimination.c (lra_eliminate_regs_1): Don't use
        simplify_gen_subreg until final substitution.
Index: lra-eliminations.c
===================================================================
--- lra-eliminations.c  (revision 210728)
+++ lra-eliminations.c  (working copy)
@@ -565,6 +565,16 @@
              alter_subreg (&x, false);
              return x;
            }
+         else if (! subst_p)
+           {
+             /* LRA can transform subregs itself.  So don't call
+                simplify_gen_subreg until LRA transformations are
+                finished.  Function simplify_gen_subreg can do
+                non-trivial transformations (like truncation) which
+                might make LRA work to fail.  */
+             SUBREG_REG (x) = new_rtx;
+             return x;
+           }
          else
            return simplify_gen_subreg (GET_MODE (x), new_rtx,
                                        GET_MODE (new_rtx), SUBREG_BYTE (x));

Reply via email to