view gcc/testsuite/gcc.dg/ipa/ipcp-cstagg-2.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
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" } } */