Debian Codegraph @

gcc/testsuite/gcc.dg/tree-prof/loop-split-3.c

raw
1 /* { dg-options "-O3 -fdump-tree-lsplit-details-blocks -fdump-tree-optimized-details-blocks" } */
2
3 int M = 100;
4 int a[1000];
5
6 void
7 __attribute__ ((noinline,noipa))
8 do_something()
9 {
10 }
11 void
12 __attribute__ ((noinline,noipa))
13 do_something2()
14 {
15 }
16
17 __attribute__ ((noinline,noipa))
18 void test1 (int n)
19 {
20 if (n <= 0 || n > 100000)
21 return;
22 for (int i = 0; i <= n; i++)
23 {
24 if (i < n)
25 do_something ();
26 if (a[i])
27 do_something2();
28 }
29 }
30 int
31 main(int, char **)
32 {
33 for (int i = 0 ; i < 1000; i+=3)
34 a[i]=1;
35 for (int i = 0 ; i < 1000; i++)
36 test1(M);
37 return 0;
38 }
39 /* { dg-final-use-not-autofdo { scan-tree-dump-times "Loop split" 1 "lsplit" } } */
40 /* { dg-final-use-not-autofdo { scan-tree-dump-times "Invalid sum" 0 "lsplit" } } */
41 /* { dg-final-use-not-autofdo { scan-tree-dump-times "Invalid sum" 0 "optimized" } } */