This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/52969] [4.7/4.8 Regression] ICE in in get_expr_operands, at tree-ssa-operands.c:1035 with -ftree-loop-if-convert-stores


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52969

--- Comment #3 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-04-13 10:39:35 UTC ---
(gdb) call debug_gimple_stmt (stmt)
_ifc_.9_27 = !(D.11217_6 > 0.0) ? _ifc_.8_26 : _ifc_.7_20;

the negate is spurious.  I have a patch.  if-conversion is also incredibly
stupid, transforming

  if (cond)
    x = a;
  else
    x = b;

to

  x = cond ? a : x;
  x = !cond ? b : x;

and only DSE removes the first dead store.  But we keep both conditionals
as nothing even tries to optimize them:

  D.1966_8 = *D.1965_7;
  _ifc_.3_12 = xsum[j_21];
  _ifc_.5_19 = D.1966_8 > 0.0 ? 0.0 : _ifc_.3_12;
  D.1983_25 = D.1966_8 > 0.0;
  D.1984_26 = ~D.1983_25;
  _ifc_.8_27 = D.1983_25 ? _ifc_.5_19 : D.1966_8;
  xsum[j_21] = _ifc_.8_27;


Reduced testcase:

int a, b;
float xsum[100];
void foo (float *cluster)
{
  int j;
  for (; a ; ++j) {
      xsum[j] = cluster[j];
      if (xsum[j] > 0)
        xsum[j] = 0;
  }
  if (xsum[0])
    b = 0;
}

I have a patch.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]