Merge from mainline (gomp-merge-2005-02-26).
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / loop-4.c
blob8ba535b597ab05a6e8033996000b0bf781d8ec04
1 /* A test for strength reduction and induction variable elimination. */
3 /* { dg-do compile } */
4 /* { dg-options "-O1 -fdump-tree-vars" } */
6 /* Size of this structure should be sufficiently weird so that no memory
7 addressing mode applies. */
9 struct bla
11 char x[187];
12 int y;
13 char z[253];
14 } arr_base[100];
16 int foo(void);
18 void xxx(void)
20 int iter;
22 for (iter = 0; iter < 100; iter++)
23 arr_base[iter].y = foo ();
26 /* Access to arr_base[iter].y should be strength reduced. Depending on
27 whether we have an addressing mode of type [base + offset], one of the
28 following forms might get chosen:
30 -- induction variable with base &arr_base[0].y, the memory access of
31 form *iv = ...
32 -- induction variable with base 0, the memory access of form
33 *(iv + &arr_base[0].y) = ...
35 In any case, we should not have 'arr_base.[^0].* =' */
37 /* { dg-final { scan-tree-dump-times "arr_base.\[^0\]\[^\\n\\r\]*=" 0 "vars" } } */
39 /* And the original induction variable should be eliminated. */
41 /* { dg-final { scan-tree-dump-times "iter" 0 "vars" } } */