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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu.org

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Hm, OK.  So I actually thought of this issue.  It's basically a hole in the
requirement of all function "exits" having a virtual use and thus virtual
PHIs being created along the paths to it.  I was aware of GIMPLE_RESX and
thought about const noreturn (but that attribute combination is rejected).

IPA pure-const detects func_15 as looping 'const' and noreturn:

Function is locally const.
Function found to be noreturn: func_15
Function found to be looping const: func_15/2
Declaration updated to be looping const: func_15/2

so there's two ways to "fix" this, one - drop the assumption we have
PHIs on the paths to function exit (including in not returning regions).
That makes

virtual_operand_live::get_live_in (basic_block bb)
{
...
  /* Since we don't have a virtual PHI we can now pick any of the
     incoming edges liveout value.  All returns from the function have
     a virtual use forcing generation of virtual PHIs.  */
  edge_iterator ei;
  edge e;
  FOR_EACH_EDGE (e, ei, bb->preds)
    if (liveout[e->src->index])
      {
        if (EDGE_PRED (bb, 0) != e)
          liveout[EDGE_PRED (bb, 0)->src->index] = liveout[e->src->index];
        return liveout[e->src->index];
      }

instead required to check each edge and we can't simply take the value
from the immediate dominator as fallback.  When we discover divergence
we need to return NULL (unknown - nobody created the actually live VOP).

The other alternative is to make sure we _do_ have the virtual operand.
Either by making sure the "invalid" combination of const + noreturn
isn't detected or by creating a virtual use in that case anyway
(and fixup code because of that inconsistency).

Reply via email to