[Bug tree-optimization/101186] predictable comparison of integer variables not folded

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jun 24 06:49:54 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101186

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |85316

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
The complication is that the a == b equivalence has to be taken into account to
relate the c < a and c >= b relations.

Maybe the new relation code can do sth here, but confirmed on trunk.

void g (int a, int b, int x, int y)
{
  int c = y;
  if (a != 0)
    c = x;
  while (b < 1000)
  // without this loop, jump thread & VRP can remove dead code
    {
      if (a != 0)
        {
          if (c > x)
            printf ("Unreachable!");
        }

that's also a classical example for predicated value-numbering (which we
don't implement).


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85316
[Bug 85316] [meta-bug] VRP range propagation missed cases


More information about the Gcc-bugs mailing list