1/* { dg-do compile } */
2/* { dg-options "-O1 -fdump-tree-dom2" } */
3
4extern void abort (void);
5
6union tree_node;
7typedef union tree_node *tree;
8extern const char tree_code_type[];
9
10union tree_node
11{
12  int code;
13  long pointer_alias_set;
14};
15
16long
17get_alias_set (t)
18     tree t;
19{
20  if (tree_code_type[t->code])
21    abort ();
22  if (t->pointer_alias_set)
23    {
24      tree __t = t;
25      if (tree_code_type[__t->code])
26	abort ();
27    }
28}
29
30/* There should be precisely one load of {t,__t}->code.  If there is
31   more than one, then the dominator optimizations failed.  */
32/* { dg-final { scan-tree-dump-times "->code" 1 "dom2"} } */
33
34/* There should be precisely one load of tree_code_type.  If there is
35   more than one, then the dominator optimizations failed.  */
36/* { dg-final { scan-tree-dump-times "tree_code_type" 1 "dom2"} } */
37
38/* There should be one IF conditional.  If 'tree_code_type[t->code]' is
39   zero, then the third if() conditional is unnecessary.  That should cause
40   the call to abort() to be removed, which in turn causes the whole second
41   if() to disappear.  */
42/* { dg-final { scan-tree-dump-times "if " 1 "dom2"} } */
43
44/* { dg-final { cleanup-tree-dump "dom2" } } */
45