2013-10-21 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / ipa / ipa-pta-1.c
bloba56e71a4adebc00354c1a20ce81a0edf7eae2b9b
1 /* { dg-do run } */
2 /* { dg-options "-O -fipa-pta -fdump-ipa-pta-details" } */
4 static int __attribute__((noinline))
5 foo (int *p, int *q)
7 *p = 2;
8 *q = 1;
9 return *p;
12 static int __attribute__((noinline))
13 bar (int *p, int *q)
15 *p = -2;
16 *q = -1;
17 return *p;
20 static int __attribute__((noinline,noclone))
21 foobar (int foo_p)
23 int a;
24 int (*fn)(int *, int *);
25 if (foo_p)
26 fn = foo;
27 else
28 fn = bar;
29 return (*fn)(&a, &a);
32 extern void abort (void);
34 int main()
36 if (foobar (1) != 1)
37 abort ();
39 return 0;
42 /* IPA PTA needs to handle indirect calls properly. Verify that
43 both bar and foo get a (and only a) in their arguments points-to sets. */
45 /* { dg-final { scan-ipa-dump "fn_1 = { bar foo }" "pta" } } */
46 /* { dg-final { scan-ipa-dump "bar.arg0 = { a }" "pta" } } */
47 /* { dg-final { scan-ipa-dump "bar.arg1 = { a }" "pta" } } */
48 /* { dg-final { scan-ipa-dump "foo.arg0 = { a }" "pta" } } */
49 /* { dg-final { scan-ipa-dump "foo.arg1 = { a }" "pta" } } */
50 /* { dg-final { cleanup-ipa-dump "pta" } } */