Date: Mon, 6 Jan 2014 00:52:39 +0000 (UTC) From: "Pedro F. Giffuni" <pfg@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260361 - head/contrib/gcc Message-ID: <201401060052.s060qdOk065684@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pfg Date: Mon Jan 6 00:52:39 2014 New Revision: 260361 URL: http://svnweb.freebsd.org/changeset/base/260361 Log: 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. The issue was detected in OpenBSD but their fix was not very good. Huge thanks to the upstream author, Eric Botcazou, for permitting the use of this patch under GPLv2. MFC after: 5 days Modified: head/contrib/gcc/combine.c Modified: head/contrib/gcc/combine.c ============================================================================== --- head/contrib/gcc/combine.c Mon Jan 6 00:15:19 2014 (r260360) +++ head/contrib/gcc/combine.c Mon Jan 6 00:52:39 2014 (r260361) @@ -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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401060052.s060qdOk065684>