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

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
>From the vrp1 dump it seems that it should be possible to determine that bb 8
and later are unreachable.  Might the predicate analysis help here as well?

int main ()
{
  const char * last;
  int i;
  const char * local_iterator;
  const char * in;
  int _3;
  char _5;
  bool iftmp.0_13;

  <bb 2> [local count: 118111600]:
  goto <bb 4>; [100.00%]

  <bb 3> [local count: 955630225]:
  last_4 = last_2 + 1;

  <bb 4> [local count: 1073741824]:
  # last_2 = PHI <"aa"(2), last_4(3)>
  _5 = *last_2;
  if (_5 != 0)
    goto <bb 3>; [89.00%]
  else
    goto <bb 5>; [11.00%]                                    <<< *last_2 ==
'\0' implies last_2 == "aa" + 2

  <bb 5> [local count: 118111600]:
  # last_12 = PHI <last_2(4)>
  if (last_12 != "aa")                                       <<< true
    goto <bb 6>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 6> [local count: 64477123]:
  if (last_12 != &MEM <const char[3]> [(void *)"aa" + 1B])   <<< true
    goto <bb 7>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 7> [local count: 55926445]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 2B])      <<< false
    goto <bb 8>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 8> [local count: 30530247]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 3B])
    goto <bb 9>; [54.59%]
  else
    goto <bb 12>; [45.41%]


  <bb 10> [local count: 14456228]:
  if (last_12 != &MEM <const char> [(void *)"aa" + 5B])
    goto <bb 11>; [54.59%]
  else
    goto <bb 12>; [45.41%]

  <bb 11> [local count: 59055800]:
  if (last_12 == &MEM <const char> [(void *)"aa" + 6B])
    goto <bb 13>; [30.00%]
  else
    goto <bb 12>; [70.00%]

  <bb 12> [local count: 100394860]:

  <bb 13> [local count: 118111600]:
  # iftmp.0_13 = PHI <0(12), 1(11)>
  _3 = (int) iftmp.0_13;
  return _3;

}

Reply via email to