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

--- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> ---
One could also look at this as a failure to propagate.

  l.0_1 = l;
  t_4 = (short int) l.0_1;
  if (t_4 == 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 6>; [50.00%]


We ought to be able to propagate l.0_1 into the conditional for t_4.  If we do
that, then we'll be able to propagate 0 for l.0_1 in this block:

;;   basic block 3, loop depth 0, count 536870912 (estimated locally, freq
0.5000)
;;    prev block 2, next block 4, flags: (NEW, VISITED)
;;    pred:       2 [50.0% (guessed)]  count:536870912 (estimated locally, freq
0.5000) (TRUE_VALUE,EXECUTABLE)
  b_5 = (char) l.0_1;
  if (b_5 != 1)
    goto <bb 4>; [0.00%]
  else
    goto <bb 5>; [100.00%]


And once we propagate the value 0 that will make the make bb5 (containing the
call to foo) unreachable.

IIRC we have (had?) some code to do these kinds of propagations through
conversions.  IIRC it was fairly conservative, perhaps overly so.

Reply via email to