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

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
Mostly to record my thoughts...

Loop unrolling inserts a __builtin_unreachable as part of unrolling one of the
loops.  DOM3 looks at the first 10 or so blocks determines they all have a
statically determined successor and collapses the mess down to:

;;   basic block 2, loop depth 0, count 0, freq 333, maybe hot
;;    prev block 0, next block 1, flags: (NEW, REACHABLE, VISITED)
;;    pred:       ENTRY [100.0%]  (FALLTHRU,EXECUTABLE)
  f[0] = 1;
  f[1] = 1;
  f[2] = 1;
  e.3_3 = e;
  b.1_1 = b;
  c.2_2 = c;
  _31 = c.2_2 != 0;
  _15 = b.1_1 == 0 ? _31 : 0;
  iftmp.0_24 = (int) _15;
  _84 = 2;
  _4 = 9;
  _47 = 3;
  _49 = 9;
  _56 = 4;
  _57 = 9;
  _25 = 5;
  _86 = 9;
  __builtin_unreachable ();
;;    succ:

And of course removes everything else.  If I work through the CFG prior to DOM3
by hand, I get the same result -- we always pass control to the block with the
__builtin_unreachable.  I really wonder if the problem is somewhere in loop
unrolling.

Reply via email to