2018-05-17 Richard Biener <rguenther@suse.de>
[official-gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / forwprop-26.c
blob2f82a1b6ae2c9074e1fb3e7944f6edcfda1b62ce
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-forwprop1 -fno-short-enums" } */
4 union tree_node;
5 typedef union tree_node *tree;
6 enum tree_code
8 MAX_TREE_CODES
9 };
10 extern unsigned char tree_contains_struct[MAX_TREE_CODES][64];
11 struct tree_base
13 __extension__ enum tree_code code:16;
14 unsigned public_flag:1;
16 enum tree_node_structure_enum
18 TS_DECL_WITH_VIS,
20 struct tree_decl_with_vis
22 unsigned comdat_flag:1;
24 union tree_node
26 struct tree_base base;
27 struct tree_decl_with_vis decl_with_vis;
29 struct varpool_node
31 tree decl;
32 struct varpool_node *next_needed, *prev_needed;
33 unsigned externally_visible:1;
35 extern struct varpool_node *varpool_nodes_queue;
36 struct pointer_set_t;
37 struct pointer_set_t *pointer_set_create (void);
38 __inline__ static unsigned char
39 varpool_externally_visible_p (struct varpool_node *vnode,
40 unsigned char aliased)
42 struct varpool_node *alias;
43 if (!(( { __typeof (vnode->decl) const __t = (vnode->decl); __t;})->decl_with_vis.comdat_flag)
44 && !((vnode->decl)->base.public_flag))
45 return 0;
46 if (aliased)
47 return 1;
48 return 0;
51 unsigned char pointer_set_contains (struct pointer_set_t *, struct varpool_node *);
53 unsigned int
54 function_and_variable_visibility (unsigned char whole_program)
56 struct cgraph_node *node;
57 struct varpool_node *vnode;
58 struct pointer_set_t *aliased_vnodes = pointer_set_create ();
59 for (vnode = varpool_nodes_queue; vnode; vnode = vnode->next_needed)
60 if (varpool_externally_visible_p
61 (vnode, pointer_set_contains (aliased_vnodes, vnode)))
62 vnode->externally_visible = 1;
65 /* { dg-final { scan-tree-dump-not "& 255" "forwprop1"} } */