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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |6.0
            Summary|r234265 causes fails on     |[6 Regression] r234265
                   |rs6000                      |causes fails on rs6000

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
This is combiner calling replace_rtx with x = (zero_extend:DI (reg:SI 3 3 [ p1
])) from = (reg:DI 3 3) to = (sign_extend:DI (clobber:SI (const_int 0 [0])))
(it will need better analysis, but perhaps it was just some optimization that
wouldn't break stuff it not everything is replaced).

So maybe we can just limit this to reload_completed (assert the mode is the
same), otherwise simply punt on replacing it at least for GCC 6.x, like we used
to do?

--- gcc/rtlanal.c       2016-03-16 18:51:43.735688164 +0100
+++ gcc/rtlanal.c       2016-03-17 00:24:28.949901218 +0100
@@ -2966,8 +2966,10 @@ replace_rtx (rtx x, rtx from, rtx to)
       if (GET_CODE (from) == REG
          && REGNO (x) == REGNO (from))
        {
-         gcc_assert (GET_MODE (x) == GET_MODE (from));
-         return to;
+         if (GET_MODE (x) == GET_MODE (from))
+           return to;
+         else
+           gcc_assert (!reload_completed);
        }
     }
   else if (GET_CODE (x) == SUBREG)

Reply via email to