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 middle-end/60482] Loop optimization regression


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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 32332
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32332&action=edit
gcc49-pr60482-2.patch

Untested fix for the ssa-ifcombine-10.c regression.  It seems that previously,
with a useless ASSERT_EXPR:
  <bb 2>:
  _4 = x_3(D) & 1;
  if (_4 == 0)
    goto <bb 5>;
  else
    goto <bb 3>;

  <bb 3>:
  x_8 = ASSERT_EXPR <x_3(D), (unsigned int) x_3(D) + 4294967295 <= 4294967294>;
  x_9 = ASSERT_EXPR <x_8, x_8 != 0>;
  _5 = x_9 & 4;
  if (_5 != 0)
    goto <bb 6>;
  else
    goto <bb 4>;

  <bb 6>:
  x_7 = ASSERT_EXPR <x_9, x_9 != 0>;
  goto <bb 5>;

  <bb 4>:

  <bb 5>:
  # t_1 = PHI <0(2), 3(6), 0(4)>
  return t_1;
(the x_7 one) VRP had to create a new bb for it and while it has been removed
afterwards, it ended up swapping the basic blocks in the second condition,
from:
  <bb 3>:
  _5 = x_3(D) & 4;
  if (_5 != 0)
    goto <bb 5>;
  else
    goto <bb 4>;

  <bb 4>:

  <bb 5>:
  # t_1 = PHI <0(2), 3(3), 0(4)>
to:
  <bb 3>:
  _5 = x_3(D) & 4;
  if (_5 != 0)
    goto <bb 4>;
  else
    goto <bb 5>;

  <bb 4>:

  <bb 5>:
  # t_1 = PHI <0(2), 3(4), 0(3)>
E.g. with -fno-tree-vrp, ssa-ifcombine-10.c fails already on vanilla trunk.

The attached untested patch should handle this situation.


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