1 /* { dg-options "-O2 -fdump-tree-optimized -fdump-ipa-profile" } */
2 unsigned int a[1000];
3 unsigned int b = 999;
4 unsigned int c = 1002;
5 unsigned int d = 1003;
6 int
main()7 main ()
8 {
9 int i;
10 unsigned int n;
11 for (i = 0; i < 1000; i++)
12 {
13 a[i]=1000+i;
14 }
15 for (i = 0; i < 1000; i++)
16 {
17 if (i % 2)
18 n = b;
19 else if (i % 3)
20 n = c;
21 else
22 n = d;
23 a[i] %= n;
24 }
25 return 0;
26 }
27 /* autofdo does not do value profiling so far */
28 /* { dg-final-use-not-autofdo { scan-ipa-dump "Transformation done: mod subtract" "profile" } } */
29 /* This is part of code checking that n is greater than the divisor so we are sure that it
30 didn't get optimized out. */
31 /* { dg-final-use-not-autofdo { scan-tree-dump "if \\(n_\[0-9\]* \\>" "optimized"} } */
32 /* { dg-final-use { scan-tree-dump-not "Invalid sum" "optimized"} } */
33