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. */
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
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 any multiplication. */
37 /* { dg-final { scan-tree-dump-times " \\* \[^\\n\\r\]*=" 0 "vars" } } */
38 /* { dg-final { scan-tree-dump-times "\[^\\n\\r\]*= \\* " 0 "vars" } } */
39 /* { dg-final { scan-tree-dump-times "MEM" 1 "vars" } } */
41 /* And the original induction variable should be eliminated. */
43 /* { dg-final { scan-tree-dump-times "iter" 0 "vars" } } */
45 /* { dg-final { cleanup-tree-dump "vars" } } */