summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/loop-unswitch-1.c
blob: de2fb2c0e4bcf9aca5a184d8bd04a383d1097079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* For PR rtl-optimization/27735  */
/* { dg-do compile } */
/* { dg-options "-O2 -funswitch-loops -fdump-tree-unswitch-details -fno-finite-loops" } */

void set_color(void);
void xml_colorize_line(unsigned int *p, int state)
{
  int c;
  switch(state) 
    {
    case 1:
      goto parse_tag;
    case 2:
      goto parse_comment;
    }

  for(;;) 
    {
      c = *p;  
      if (c == '<' && state == 0) 
	{
parse_comment: ;
	  while (*p != '\n') 
	    state = 3;
parse_tag: ;
	  while (*p != '\n') 
	    state = 0;
	  set_color();
	}
      else
	p++;
    }
}

/* Test that we actually unswitched something.  */
/* { dg-final { scan-tree-dump ";; Unswitching loop" "unswitch" } } */