2018-04-30 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-sink-5.c
blobdbdde39add669011aa661011fa7db0072a8d3a04
1 /* { dg-do compile } */
2 /* { dg-options "-Os -fdump-tree-sink-stats" } */
4 typedef short int16_t;
5 typedef unsigned char uint8_t;
7 void foo(int16_t runs[], uint8_t alpha[], int x, int count)
9 int16_t* next_runs = runs + x;
10 uint8_t* next_alpha = alpha + x;
12 while (x > 0)
14 int n = runs[0];
16 if (x < n)
18 alpha[x] = alpha[0];
19 runs[0] = (int16_t)(x);
20 runs[x] = (int16_t)(n - x);
21 break;
23 runs += n;
24 alpha += n;
25 x -= n;
28 runs = next_runs;
29 alpha = next_alpha;
30 x = count;
32 for (;;)
34 int n = runs[0];
36 if (x < n)
38 alpha[x] = alpha[0];
39 break;
41 x -= n;
42 runs += n;
46 /* We should not sink the next_runs = runs + x calculation after the loop. */
47 /* { dg-final { scan-tree-dump-times "Sunk statements:" 0 "sink" } } */