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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #16 from Richard Biener <rguenth at gcc dot gnu.org> ---
To trigger the diagnostic in GCC 12+ you also need -fno-thread-jumps.  The
issue
with this testcase is that we have

  <bb 4> [local count: 1073741824]:
  # ptr_2 = PHI <ptr_5(D)(7), _6(3)>
  if (_1 != 0)
    goto <bb 5>; [0.04%]
  else
    goto <bb 6>; [99.96%]

  <bb 5> [local count: 429496]:
  exit (1);

  <bb 6> [local count: 1073312329]:
  return ptr_2;

and predicate::init_from_control_deps does

          /* Skip if there is essentially one succesor.  */
          if (EDGE_COUNT (e->src->succs) == 2)
            {
              edge e1;
              edge_iterator ei1;
              bool skip = false;

              FOR_EACH_EDGE (e1, ei1, e->src->succs)
                {
                  if (EDGE_COUNT (e1->dest->succs) == 0)
                    {
                      skip = true;
                      break;
                    }
                }
              if (skip)
                continue;
            }

which causes us to ignore the _1 != 0 predicate on the use.  I'm not sure
what's the reason on this - we have put a limit on the number of edges in
the chain and the number of chains, so this can't be to remain within
such limit.  Simply skipping some predicates can also make the defined
domain larger which is against the intent of the pass.

Testing removal of this premature optimization(?).

Reply via email to