http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46856

--- Comment #6 from Mikael Pettersson <mikpe at it dot uu.se> 2011-01-26 
14:43:34 UTC ---
The loop in reload_combine_recognize_const_pattern contains this check:

      /* If the add clobbers another hard reg in parallel, don't move
         it past a real set of this hard reg.  */
      if (must_move_add && clobbered_regno >= 0
          && reg_state[clobbered_regno].real_store_ruid >= use_ruid)
        break;

Since the moved add is a cc0 setter, it seems reasonable to check here that
it's not moved past another cc0 setter.  Replacing the previous patch with the
following also restores bootstrap (testsuite still running):

--- gcc-4.6-20110115/gcc/postreload.c.~1~       2010-12-21 15:51:42.000000000
+0100
+++ gcc-4.6-20110115/gcc/postreload.c   2011-01-18 20:26:39.000000000 +0100
@@ -1008,6 +1008,11 @@ reload_combine_recognize_const_pattern (
          if (must_move_add && clobbered_regno >= 0
              && reg_state[clobbered_regno].real_store_ruid >= use_ruid)
            break;
+#if defined(HAVE_cc0)
+         /* Unbreak m68k, see PR bootstrap/46856. */
+         if (must_move_add && sets_cc0_p (PATTERN (use_insn)))
+           break;
+#endif

          gcc_assert (reg_state[regno].store_ruid <= use_ruid);
          /* Avoid moving a use of ADDREG past a point where it is stored.  */

Reply via email to