PR tree-optimization/33562
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-fre-56.c
blob49c6fa1d6b3330c163d58b038da2bbba6aab766e
1 /* { dg-do compile } */
2 /* { dg-options "-O -fdump-tree-fre1" } */
4 int x = 1;
5 int __attribute__((noinline,noclone)) fn ()
7 return x;
9 int (*f)();
10 int main ()
12 int res;
13 f = fn;
14 x = 0;
15 res = f ();
16 res += x;
17 if (res != 0)
18 __builtin_abort ();
19 return 0;
22 /* We should be able to optimize the load from x in main and thus the
23 addition. */
25 /* { dg-final { scan-tree-dump-times "= x;" 1 "fre1" } } */
26 /* { dg-final { scan-tree-dump-times " \\\+ " 0 "fre1" } } */