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

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed on Zen3 btw, fails with the test input already.  Note that this may
still be a latent issue in 502.gcc_r.  -funroll-loops isn't neccessary,
-O3 -flto was enough to reproduce (no specific sub-architecture required).

-fno-strict-aliasing avoids the issue. 

--param dse-max-object-size=0 doesn't help (turn off live byte tracking)

The patch itself likely adds quite some extra DSE so that's too much to
track down.  DSE doesn't have a debug counter at the moment,
but "bisecting" --param dse-max-alias-queries-per-store shows the issue
still happens with 64 but not with 48.

The issue still reproduces with -flto-partition=1to1 (if one wants to
try per-TU compile flags) and with -flto-partition=one (if you want to
add a debug counter and bisect the bad store, but =one is slow).

We ICE in cfgloopmanip.c:create_preheader here:

basic_block
create_preheader (struct loop *loop, int flags)
{
  edge e, fallthru;
  basic_block dummy;
  int nentry = 0;
  bool irred = false;
  bool latch_edge_was_fallthru;
  edge one_succ_pred = NULL, single_entry = NULL;
  edge_iterator ei;

  FOR_EACH_EDGE (e, ei, loop->header->preds)
    { 
      if (e->src == loop->latch)
        continue;
      irred |= (e->flags & EDGE_IRREDUCIBLE_LOOP) != 0;
      nentry++;
      single_entry = e;
      if (single_succ_p (e->src))
        one_succ_pred = e;
    }
  gcc_assert (nentry);
^^^

placing noinline on the above function still reproduces the issue.  We
seem to run the above for the loop tree root but call from create_preheaders
which does

1425      FOR_EACH_LOOP (li, loop, 0)
1426        create_preheader (loop, flags);

(note absence of LI_INCLUDE_ROOT) so somehow the loop iterator setup
is broken.

Reply via email to