1 /* { dg-do compile } */ 2 /* { dg-options "-Os -fdump-tree-sink-stats" } */ 3 4 typedef short int16_t; 5 typedef unsigned char uint8_t; 6 foo(int16_t runs[],uint8_t alpha[],int x,int count)7void foo(int16_t runs[], uint8_t alpha[], int x, int count) 8 { 9 int16_t* next_runs = runs + x; 10 uint8_t* next_alpha = alpha + x; 11 12 while (x > 0) 13 { 14 int n = runs[0]; 15 16 if (x < n) 17 { 18 alpha[x] = alpha[0]; 19 runs[0] = (int16_t)(x); 20 runs[x] = (int16_t)(n - x); 21 break; 22 } 23 runs += n; 24 alpha += n; 25 x -= n; 26 } 27 28 runs = next_runs; 29 alpha = next_alpha; 30 x = count; 31 32 for (;;) 33 { 34 int n = runs[0]; 35 36 if (x < n) 37 { 38 alpha[x] = alpha[0]; 39 break; 40 } 41 x -= n; 42 runs += n; 43 } 44 } 45 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" } } */ 48