1 /* A test for final value replacement and higher-order ivs,
2    see PR 22442.  */
3 
4 /* { dg-do compile } */
5 /* { dg-options "-O1 -fdump-tree-optimized" } */
6 
7 void bar (unsigned);
8 
foo(void)9 void foo (void)
10 {
11   unsigned i, a;
12 
13   for (i = 0; i < 5; i++)
14     a = i * i;
15 
16   bar (a);
17 }
18 
19 /* Final value of a gets replaced.  */
20 
21 /* { dg-final { scan-tree-dump-times "\\(16\\)" 1 "optimized" } } */
22 
23 /* And the empty loop is removed.  */
24 
25 /* { dg-final { scan-tree-dump-times "if " 0 "optimized" } } */
26 
27 
28