Author: pfg
Date: Sat Jan 11 01:45:20 2014
New Revision: 260529
URL: http://svnweb.freebsd.org/changeset/base/260529

Log:
  MFC   r260361:
  
  gcc: Fix optimization bug.
  
  GCC-PR rtl-optimization/34628
        * combine.c (try_combine): Stop and undo after the first combination
        if an autoincrement side-effect on the first insn has effectively
        been lost.

Modified:
  stable/9/contrib/gcc/combine.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/gcc/   (props changed)

Modified: stable/9/contrib/gcc/combine.c
==============================================================================
--- stable/9/contrib/gcc/combine.c      Sat Jan 11 01:44:22 2014        
(r260528)
+++ stable/9/contrib/gcc/combine.c      Sat Jan 11 01:45:20 2014        
(r260529)
@@ -2370,12 +2370,17 @@ try_combine (rtx i3, rtx i2, rtx i1, int
 
   if (i1 && GET_CODE (newpat) != CLOBBER)
     {
-      /* Before we can do this substitution, we must redo the test done
-        above (see detailed comments there) that ensures  that I1DEST
-        isn't mentioned in any SETs in NEWPAT that are field assignments.  */
-
-      if (! combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX,
-                             0, (rtx*) 0))
+      /* Check that an autoincrement side-effect on I1 has not been lost.
+        This happens if I1DEST is mentioned in I2 and dies there, and
+        has disappeared from the new pattern.  */
+      if ((FIND_REG_INC_NOTE (i1, NULL_RTX) != 0
+          && !i1_feeds_i3
+          && dead_or_set_p (i2, i1dest)
+          && !reg_overlap_mentioned_p (i1dest, newpat))
+         /* Before we can do this substitution, we must redo the test done
+            above (see detailed comments there) that ensures  that I1DEST
+            isn't mentioned in any SETs in NEWPAT that are field assignments.  
*/
+          || !combinable_i3pat (NULL_RTX, &newpat, i1dest, NULL_RTX, 0, 0))
        {
          undo_all ();
          return 0;
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to