OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [tree-ssa/] [loadpre6.c] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* { dg-do compile } */
2
/* { dg-options "-O2 -fdump-tree-pre-stats" } */
3
 
4
union tree_node;
5
typedef union tree_node *tree;
6
 
7
struct tree_common
8
{
9
  tree chain;
10
};
11
 
12
struct tree_list
13
{
14
  struct tree_common common;
15
  tree value;
16
};
17
 
18
union tree_node
19
 
20
{
21
  struct tree_common common;
22
  struct tree_list list;
23
};
24
 
25
extern void abort (void) __attribute__((noreturn));
26
 
27
void __attribute__((noinline))
28
foo (void)
29
{
30
  abort ();
31
}
32
 
33
/* There are some reloaded loads of *cell, and cell->common.chain on various
34
   branches.  */
35
void __attribute__((noinline))
36
remove_useless_vars (tree *unexpanded_var_list, int dump_file)
37
{
38
  tree var, *cell;
39
  int c = 0;
40
  for (cell = unexpanded_var_list; *cell; )
41
    {
42
      var = (*cell)->list.value;
43
      if (var)
44
        {
45
          if (dump_file)
46
            foo ();
47
 
48
          *cell = ((*cell)->common.chain);
49
          continue;
50
        }
51
 
52
      cell = &((*cell)->common.chain);
53
    }
54
}
55
extern void *malloc (__SIZE_TYPE__) __attribute__ ((malloc));
56
 
57
int
58
main (void)
59
{
60
  int i;
61
  tree unexpanded_var_list, last = (tree) 0;
62
 
63
  for (i = 0; i < 2; i++)
64
    {
65
      unexpanded_var_list = malloc (sizeof (struct tree_list));
66
      unexpanded_var_list->list.value = (tree) (long unsigned) (i & 1);
67
      unexpanded_var_list->common.chain = last;
68
      last = unexpanded_var_list;
69
    }
70
 
71
  remove_useless_vars (&unexpanded_var_list, 0);
72
  return 0;
73
}
74
/* { dg-final { scan-tree-dump-times "Eliminated: 2" 1 "pre" } } */
75
/* { dg-final { cleanup-tree-dump "pre" } } */
76
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.