Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / pr21559.c
blob34f4a01db00bc1422e70634a46296bb8bb995ab0
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-vrp1-details" } */
4 static int blocksize = 4096;
6 int bar (int);
8 void foo (void)
10 int toread;
11 int bytes;
12 static char eof_reached = 0;
14 toread = blocksize;
15 bytes = 1;
17 while (toread != 0)
19 bytes = bar (toread);
20 if (bytes <= 0)
22 if (bytes < 0)
23 continue;
24 break;
26 toread -= bytes;
29 if (bytes == 0)
30 eof_reached = 1;
34 /* First, we should simplify the bits < 0 test within the loop. */
35 /* { dg-final { scan-tree-dump-times "Simplified relational" 1 "vrp1" } } */
37 /* Second, we should thread the edge out of the loop via the break
38 statement. We also realize that the final bytes == 0 test is useless,
39 and thread over it. */
40 /* { dg-final { scan-tree-dump-times "Threaded jump" 3 "vrp1" } } */
42 /* { dg-final { cleanup-tree-dump "vrp1" } } */