[Bug rtl-optimization/82621] [6/7 Regression] wrong code with -Og -fgcse -fweb

2017-11-29 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82621

--- Comment #11 from Segher Boessenkool  ---
Author: segher
Date: Wed Nov 29 22:42:37 2017
New Revision: 255260

URL: https://gcc.gnu.org/viewcvs?rev=255260=gcc=rev
Log:
combine: Do not throw away unneeded arms of parallels (PR83156)

The fix for PR82621 makes us not split an I2 if one of the results of
those SETs is unused, since combine does not handle that properly.  But
this results in degradation for i386 (or more in general, for any
target that does not have patterns for parallels with an unused result
as a CLOBBER instead of a SET for that result).

This patch instead makes us not split only if one of the results is set
again before I3.  That fixes PR83156 and also fixes PR82621.

Unfortunately it undoes the nice optimisations that the previous patch
did on powerpc.


PR rtl-optimization/83156
PR rtl-optimization/82621
* combine.c (try_combine): Don't split an I2 if one of the dests is
set again before I3.  Allow unused dests.

Modified:
trunk/gcc/ChangeLog
trunk/gcc/combine.c

[Bug rtl-optimization/82621] [6/7 Regression] wrong code with -Og -fgcse -fweb

2017-11-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82621

Segher Boessenkool  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Segher Boessenkool  ---
Fixed on all open branches.

[Bug rtl-optimization/82621] [6/7 Regression] wrong code with -Og -fgcse -fweb

2017-11-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82621

--- Comment #9 from Segher Boessenkool  ---
Author: segher
Date: Fri Nov 24 17:03:04 2017
New Revision: 255143

URL: https://gcc.gnu.org/viewcvs?rev=255143=gcc=rev
Log:
combine: Don't split insns if half is unused (PR82621)

If we have a PARALLEL of two SETs, and one half is unused, we currently
happily split that into two instructions (albeit the unused one is
useless).  Worse, as PR82621 shows, combine will happily merge this
insn into I3 even if some intervening insn sets the same register
again, which is wrong.

This fixes it by not splitting PARALLELs with REG_UNUSED notes.  It
all is handled fine by combine in that case; just the "single set
that is unused" case isn't handled properly.

This also results in better code: combine will now actually throw
away the unused SET.  (It still won't do that in an I3).


PR rtl-optimization/82621
* combine.c (try_combine): Do not split PARALLELs of two SETs if the
dest of one of those SETs is unused.

Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/combine.c

[Bug rtl-optimization/82621] [6/7 Regression] wrong code with -Og -fgcse -fweb

2017-11-24 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82621

--- Comment #8 from Segher Boessenkool  ---
Author: segher
Date: Fri Nov 24 17:00:57 2017
New Revision: 255142

URL: https://gcc.gnu.org/viewcvs?rev=255142=gcc=rev
Log:
combine: Don't split insns if half is unused (PR82621)

If we have a PARALLEL of two SETs, and one half is unused, we currently
happily split that into two instructions (albeit the unused one is
useless).  Worse, as PR82621 shows, combine will happily merge this
insn into I3 even if some intervening insn sets the same register
again, which is wrong.

This fixes it by not splitting PARALLELs with REG_UNUSED notes.  It
all is handled fine by combine in that case; just the "single set
that is unused" case isn't handled properly.

This also results in better code: combine will now actually throw
away the unused SET.  (It still won't do that in an I3).


PR rtl-optimization/82621
* combine.c (try_combine): Do not split PARALLELs of two SETs if the
dest of one of those SETs is unused.

Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/combine.c

[Bug rtl-optimization/82621] [6/7 Regression] wrong code with -Og -fgcse -fweb

2017-11-23 Thread segher at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82621

--- Comment #7 from Segher Boessenkool  ---
*** Bug 81291 has been marked as a duplicate of this bug. ***