[Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-07-08 Thread kyukhin at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576

--- Comment #6 from Kirill Yukhin kyukhin at gcc dot gnu.org ---
Author: kyukhin
Date: Tue Jul  8 07:52:12 2014
New Revision: 212347

URL: https://gcc.gnu.org/viewcvs?rev=212347root=gccview=rev
Log:
PR tree-optimization/61576

gcc/
* tree-if-conv.c (is_cond_scalar_reduction): Add check that
basic block containing reduction statement is predecessor
of phi basi block.

gcc/testsuite/
* gcc.dg/torture/pr61576.c: New test.


Added:
trunk/gcc/testsuite/gcc.dg/torture/pr61576.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/testsuite/ChangeLog
trunk/gcc/tree-if-conv.c


[Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-06-26 Thread izamyatin at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576

Igor Zamyatin izamyatin at gmail dot com changed:

   What|Removed |Added

 CC||izamyatin at gmail dot com

--- Comment #5 from Igor Zamyatin izamyatin at gmail dot com ---
Patch is posted at http://gcc.gnu.org/ml/gcc-patches/2014-06/msg01866.html


[Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-06-23 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576

Jakub Jelinek jakub at gcc dot gnu.org changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2014-06-23
 CC||chrbr at gcc dot gnu.org,
   ||jakub at gcc dot gnu.org
   Target Milestone|--- |4.10.0
Summary|wrong code at -O3 on|[4.10 Regression] wrong
   |x86_64-linux-gnu|code at -O3 on
   ||x86_64-linux-gnu
 Ever confirmed|0   |1

--- Comment #1 from Jakub Jelinek jakub at gcc dot gnu.org ---
Worked up to and including r209971, started to ICE with r209972, that got fixed
in r211263.  The wrong-code started in r211302.  Given that was a cost change,
supposedly this has been latent before?


[Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-06-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576

--- Comment #2 from Richard Biener rguenth at gcc dot gnu.org ---
Hmm, but it doesn't do any PHI hoisting.  -fno-tree-loop-if-convert fixes it,
-O2 -ftree-loop-if-convert breaks it.


[Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-06-23 Thread rguenth at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576

Richard Biener rguenth at gcc dot gnu.org changed:

   What|Removed |Added

 CC||ysrumyan at gmail dot com

--- Comment #3 from Richard Biener rguenth at gcc dot gnu.org ---
+Found cond scalar reduction.
+d.6_12 = d_lsm.14_16 + 1;


[Bug tree-optimization/61576] [4.10 Regression] wrong code at -O3 on x86_64-linux-gnu

2014-06-23 Thread ysrumyan at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61576

--- Comment #4 from Yuri Rumyantsev ysrumyan at gmail dot com ---
There is an issue with phi-node and reduction stmt - after r211302 new hammock
was inserted between reduction stmt and bb containing phi:

  bb 6:
  d.6_12 = d_lsm.14_17 + 1;
  if (c.8_13 != 0)
goto bb 7;
  else
goto bb 8;

  bb 7:

  bb 8:
  # iftmp.7_15 = PHI 1(7), _19(6)

  bb 9:
  # d_lsm.14_16 = PHI d_lsm.14_17(5), d.6_12(8)

but algorithm for converting conditional scalar reduction assumes that basic
block containing reduction is one of predecessors of phi-block. I added check
on it and test is passed.

BTW I wonder why such code motion has been done - in fact, redundant
computations were introduced in loop, before this fix all computations related
to hammock were hoisted out off loop:

  bb 4:
  d_lsm.14_25 = d;
  c.8_13 = c;
  f.9_14 = f;
  _18 = f.9_14 != 0;
  _19 = (int) _18;
  iftmp.7_15 = c.8_13 != 0 ? 1 : _19;
  e_lsm.15_26 = e;

  bb 5:
  # d_lsm.14_17 = PHI d_lsm.14_25(4), d_lsm.14_16(9)
  # e_lsm.15_1 = PHI e_lsm.15_26(4), e_lsm.15_24(9)
  b.4_10 ={v} b;
  if (b.4_10 != 0)
goto bb 6;
  else
goto bb 7;

  bb 6:
  d.6_12 = d_lsm.14_17 + 1;

  bb 7:
  # d_lsm.14_16 = PHI d_lsm.14_17(5), d.6_12(6)
  # e_lsm.15_24 = PHI e_lsm.15_1(5), iftmp.7_15(6)

I will send for review patch after required testing completion.