111
|
1 /* { dg-do compile } */
|
|
2 /* { dg-options "-O2 -fdump-tree-ivopts-details" } */
|
|
3
|
|
4 int *a;
|
|
5
|
|
6 int
|
|
7 foo1 (long long s, long long l)
|
|
8 {
|
|
9 long long i;
|
|
10
|
|
11 for (i = s; i < l; i++)
|
|
12 {
|
|
13 a[(short)i] = 0;
|
|
14 }
|
|
15 return 0;
|
|
16 }
|
|
17
|
|
18 int
|
|
19 foo2 (unsigned char s, unsigned char l, unsigned char c)
|
|
20 {
|
|
21 unsigned char i, step = 1;
|
|
22 int sum = 0;
|
|
23
|
|
24 for (i = s; i < l; i++)
|
|
25 {
|
|
26 sum += a[c];
|
|
27 c += step;
|
|
28 }
|
|
29
|
|
30 return sum;
|
|
31 }
|
|
32
|
|
33 int
|
|
34 foo3 (unsigned char s, unsigned char l, unsigned char c)
|
|
35 {
|
|
36 unsigned char i;
|
|
37 int sum = 0;
|
|
38
|
|
39 for (i = s; i != l; i += c)
|
|
40 {
|
|
41 sum += a[i];
|
|
42 }
|
|
43
|
|
44 return sum;
|
|
45 }
|
|
46
|
|
47 int
|
|
48 foo4 (unsigned char s, unsigned char l)
|
|
49 {
|
|
50 unsigned char i;
|
|
51 int sum = 0;
|
|
52
|
|
53 for (i = s; i != l; i++)
|
|
54 {
|
|
55 sum += a[i];
|
|
56 }
|
|
57
|
|
58 return sum;
|
|
59 }
|
|
60
|
|
61 /* Address of array references are not scevs. */
|
|
62 /* { dg-final { scan-tree-dump-not " Type:\\tADDRESS\n Use \[0-9\].\[0-9\]:" "ivopts" } } */
|