view gcc/testsuite/gcc.dg/ipa/ipcp-cstagg-2.c @ 158:494b0b89df80 default tip

...
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 18:13:55 +0900
parents 84e7813d76e9
children
line wrap: on
line source

/* { dg-do compile } */
/* { dg-options "-O3 -fdump-ipa-cp-details -fno-ipa-sra" } */

typedef struct S
{
  int (*call)(int);
} S;

static int __attribute__((noinline))
bar (const S *f, int x)
{
  x = f->call(x);
  return x;
}

extern void impossible_aa (void);

static int __attribute__((noinline))
baz (const S *f, int x)
{
  impossible_aa ();
  return bar (f, x);
}

static int
sq (int x)
{
  return x * x;
}

static const S s = {sq};

int
g (int x)
{
  return baz (&s, x);
}

int
obfuscate (int x)
{
  return baz ((S *) 0, x);
}

/* { dg-final { scan-ipa-dump "Discovered an indirect call to a known target" "cp" } } */