[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-31 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

Bill Schmidt  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #16 from Bill Schmidt  ---
Latent SLSR bug is now fixed everywhere also.

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-31 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #15 from Bill Schmidt  ---
Author: wschmidt
Date: Thu Jan 31 21:55:45 2019
New Revision: 268431

URL: https://gcc.gnu.org/viewcvs?rev=268431&root=gcc&view=rev
Log:
2018-01-31  Bill Schmidt  

Backport from mainline
2018-01-31  Bill Schmidt  

PR tree-optimization/89008
* gimple-ssa-strength-reduction.c (slsr_process_mul): Don't
process anything of the form X * 0.


Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/gimple-ssa-strength-reduction.c

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-31 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #14 from Bill Schmidt  ---
Author: wschmidt
Date: Thu Jan 31 17:14:36 2019
New Revision: 268425

URL: https://gcc.gnu.org/viewcvs?rev=268425&root=gcc&view=rev
Log:
2018-01-31  Bill Schmidt  

Backport from mainline
2018-01-31  Bill Schmidt  

PR tree-optimization/89008
* gimple-ssa-strength-reduction.c (slsr_process_mul): Don't
process anything of the form X * 0.


Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/gimple-ssa-strength-reduction.c

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-31 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #13 from Bill Schmidt  ---
Author: wschmidt
Date: Thu Jan 31 13:53:06 2019
New Revision: 268422

URL: https://gcc.gnu.org/viewcvs?rev=268422&root=gcc&view=rev
Log:
2018-01-31  Bill Schmidt  

PR tree-optimization/89008
* gimple-ssa-strength-reduction.c (slsr_process_mul): Don't
process anything of the form X * 0.


Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimple-ssa-strength-reduction.c

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-24 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #12 from Bill Schmidt  ---
Yes, fully agree -- I'll take care of that probably tomorrow.  Too many
meetings this week...

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #10 from Richard Biener  ---
Author: rguenth
Date: Thu Jan 24 11:07:19 2019
New Revision: 268235

URL: https://gcc.gnu.org/viewcvs?rev=268235&root=gcc&view=rev
Log:
2019-01-24  Richard Biener  

Backport from mainline
2019-01-23  Richard Biener  

PR tree-optimization/89008
* tree-ssa-reassoc.c (eliminate_using_constants): For * 0 do
not leave another stray operand.

* gcc.dg/torture/pr89008.c: New testcase.

Added:
branches/gcc-7-branch/gcc/testsuite/gcc.dg/torture/pr89008.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/testsuite/ChangeLog
branches/gcc-7-branch/gcc/tree-ssa-reassoc.c

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

Richard Biener  changed:

   What|Removed |Added

  Known to work||7.4.1, 8.2.1

--- Comment #11 from Richard Biener  ---
"fixed" everywhere, I'm out of the way now, SLSR is still latently buggy (I
suggest to simply "ignore" * 0 stmts)

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #9 from Richard Biener  ---
Bill, you now need r268233 or earlier on the GCC 8 branch to reproduce the
latent issue.

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-24 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #8 from Richard Biener  ---
Author: rguenth
Date: Thu Jan 24 09:31:51 2019
New Revision: 268234

URL: https://gcc.gnu.org/viewcvs?rev=268234&root=gcc&view=rev
Log:
2019-01-24  Richard Biener  

Backport from mainline
2019-01-23  Richard Biener  

PR tree-optimization/89008
* tree-ssa-reassoc.c (eliminate_using_constants): For * 0 do
not leave another stray operand.

* gcc.dg/torture/pr89008.c: New testcase.

Added:
branches/gcc-8-branch/gcc/testsuite/gcc.dg/torture/pr89008.c
Modified:
branches/gcc-8-branch/gcc/ChangeLog
branches/gcc-8-branch/gcc/testsuite/ChangeLog
branches/gcc-8-branch/gcc/tree-ssa-reassoc.c

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread wschmidt at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #7 from Bill Schmidt  ---
(In reply to Richard Biener from comment #5)
> Created attachment 45506 [details]
> patch for the * 0 issue in reassoc
> 
> I am testing a mitigation (and missed optimization fix) in reassoc.  Bill,
> can you look into the SLSR issue which is still latent?

Yes, I'll look into it.  * 0, eh?  Yeah, I probably didn't think about that.
:-)

Probably will be a couple of days before I get to it.

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #6 from Richard Biener  ---
Author: rguenth
Date: Wed Jan 23 14:02:13 2019
New Revision: 268186

URL: https://gcc.gnu.org/viewcvs?rev=268186&root=gcc&view=rev
Log:
2019-01-23  Richard Biener  

PR tree-optimization/89008
* tree-ssa-reassoc.c (eliminate_using_constants): For * 0 do
not leave another stray operand.

* gcc.dg/torture/pr89008.c: New testcase.

Added:
trunk/gcc/testsuite/gcc.dg/torture/pr89008.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-ssa-reassoc.c

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #5 from Richard Biener  ---
Created attachment 45506
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45506&action=edit
patch for the * 0 issue in reassoc

I am testing a mitigation (and missed optimization fix) in reassoc.  Bill, can
you look into the SLSR issue which is still latent?

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #4 from Richard Biener  ---
(In reply to Martin Liška from comment #3)
> Started with r236440 and was fixed with r263875.

Thanks Martin - this means both the * 0 added by reassoc and the SLSR issue
are latent.

Found * 0, removing all other ops
Width = 1 was chosen for reassociation
Transforming _12 = _10 * 83886080;
 into _12 = b_lsm.9_34 * 0;

GIMPLE testcase that shows the above on trunk:

unsigned long a;
unsigned b;
long int __GIMPLE (startwith("reassoc"))
f ()
{
  unsigned int _4;
  unsigned int _6;
  unsigned int _10;
  unsigned int _12;
  unsigned int _19;
  unsigned int _33;
  unsigned int _36;
  unsigned long g_21;
  unsigned int b_lsm9_34;

  bb_2:
  b_lsm9_34 = b;
  _36 = b_lsm9_34 * 83886080u;
  _33 = _36 * 83886080u;
  _4 = _33 * 83886080u;
  _10 = _4 * 83886080u;
  _12 = _10 * 83886080u;
  _19 = _12 * 2u;
  _6 = -_19;
  g_21 = (long unsigned int) _6;
  a = g_21;
  return 0l;

}

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread marxin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

--- Comment #3 from Martin Liška  ---
Started with r236440 and was fixed with r263875.

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

Richard Biener  changed:

   What|Removed |Added

 CC||wschmidt at gcc dot gnu.org

--- Comment #2 from Richard Biener  ---
Eventually the issue also just became latent.  SLSR does

Replacing: _7 = _12 * 83886080;
With: _7 = _12;

Replacing: _19 = _12 * 2;
With: _19 = _2;

where the latter is bogus replacing 0 with 4.  Eventually SLSR is confused by

  _12 = b_lsm.9_34 * 0;

being present in the IL, not sure.  IL before SLSR:

  _12 = b_lsm.9_34 * 0;
...
  _2 = _12 + 4;
...
  _19 = _12 * 2;
  _6 = -_19;
  g_21 = (long unsigned int) _6;
  a = g_21;

possibly checks some multiple-of which breaks down with zero.

On trunk the * 0 is gone (possibly the "fix").

[Bug middle-end/89008] [7/8 Regression] O2 and O1 results differ for simple test

2019-01-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89008

Richard Biener  changed:

   What|Removed |Added

   Priority|P3  |P2
 Status|UNCONFIRMED |NEW
  Known to work||6.4.0, 9.0
   Keywords||needs-bisection, wrong-code
   Last reconfirmed||2019-01-23
 CC||marxin at gcc dot gnu.org
 Ever confirmed|0   |1
Summary|O2 and O1 results differ|[7/8 Regression] O2 and O1
   |for simple test |results differ for simple
   ||test
   Target Milestone|--- |7.5
  Known to fail||7.4.0, 8.2.0

--- Comment #1 from Richard Biener  ---
Confirmed.  Seems to work on trunk, disabling SLSR fixes it.  We end up with

f ()
{
   [local count: 14598063]:
  b = 0;
  c = 4;
  e = 6;
  d = 6;
  a = 4294967292;
  return 0;

so I guess a fix needs backporting.  Martin, can you bisect the fix?