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

--- Comment #39 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
This testcase
#include <stdio.h>
int data[100];

__attribute__((noinline))
int bar (int d, unsigned int d2)
{
  if (d2 > 10)
    printf ("Bingo\n");
  return d + d2;
}

int
test2 (unsigned int i)
{
  if (i > 10)
    __builtin_unreachable ();
  if (__builtin_expect (data[i] != 0, 1))
    return data[i];
  printf ("%i\n",i);
  for (int j = 0; j < 100; j++)
    data[i] += bar (data[j], i+17);
  return data[i];
}
int
test (unsigned int i)
{
  if (i > 100)
    __builtin_unreachable ();
  if (__builtin_expect (data[i] != 0, 1))
    return data[i];
  printf ("%i\n",i);
  for (int j = 0; j < 100; j++)
    data[i] += bar (data[j], i+17);
  return data[i];
}
int
main ()
{
  test (1);
  test (2);
  test (3);
  test2 (4);
  test2 (100);
  return 0;
}

gets me most of what I want to reproduce ipa-prop problem. Functions test and
test2 are split with different value ranges visible in the fnsplit dump. 
However curiously enough ipa-prop analysis seems to ignore the value ranges and
does not attach them to the jump function, which is odd...

Reply via email to