]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/g++.dg/ipa/pure-const-3.C
Add IPA VRP
[thirdparty/gcc.git] / gcc / testsuite / g++.dg / ipa / pure-const-3.C
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-ipa-vrp -fdump-tree-optimized" } */
3 int *ptr;
4 static int barvar;
5 static int b(int a);
6 /* We can not detect A to be const because it may be interposed by unoptimized
7 body. */
8 inline
9 __attribute__ ((noinline))
10 int a(int a)
11 {
12 if (a>0)
13 return b(a-1);
14 return *ptr == *ptr;
15 }
16 inline
17 __attribute__ ((noinline))
18 static int b(int p)
19 {
20 if (p<0)
21 return a(p+1);
22 return 1;
23 }
24 main()
25 {
26 int aa;
27 ptr = &barvar;
28 aa=!b(3);
29 ptr = 0;
30 return aa;
31 }
32 /* { dg-final { scan-tree-dump "barvar" "optimized" } } */