annotate gcc/testsuite/gcc.dg/tree-ssa/loop-8.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* A test for strength reduction of ivs with nonconstant step. */
kono
parents:
diff changeset
2
kono
parents:
diff changeset
3 /* { dg-do compile } */
kono
parents:
diff changeset
4 /* { dg-options "-O1 -fdump-tree-optimized" } */
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 int bar (void);
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 int a[100];
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 void xxx (void)
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 int iter, step = bar ();
kono
parents:
diff changeset
13
kono
parents:
diff changeset
14 for (iter = 0; iter < 10; iter++)
kono
parents:
diff changeset
15 a[iter * step] = bar ();
kono
parents:
diff changeset
16 }
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 /* The array access should be strength reduced. But to determine the value of
kono
parents:
diff changeset
19 the step, we need to calculate step * sizeof (int), thus we need to be
kono
parents:
diff changeset
20 a bit careful about which multiplications we disallow. */
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 /* { dg-final { scan-tree-dump-times "step \\* \[^0-9\]" 0 "optimized" } } */
kono
parents:
diff changeset
23 /* { dg-final { scan-tree-dump-times "\[^0-9\] \\* step" 0 "optimized" } } */
kono
parents:
diff changeset
24