1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-dom2-details -w" } */
3 typedef long unsigned int size_t;
4 union tree_node;
5 typedef union tree_node *tree;
6 typedef union gimple_statement_d *gimple;
7 typedef const union gimple_statement_d *const_gimple;
8 union gimple_statement_d
9 {
10   unsigned num_ops;
11   tree exp;
12 };
13 
14 unsigned int x;
15 static inline tree
gimple_op(const_gimple gs,unsigned i)16 gimple_op (const_gimple gs, unsigned i)
17 {
18   if (!(i < gs->num_ops))
19     abort ();
20   return gs->exp;
21 }
22 
23 unsigned char
scan_function(gimple stmt)24 scan_function (gimple stmt)
25 {
26   unsigned i;
27   for (i = 0; i < stmt->num_ops - 3 ; i++)
28     gimple_call_arg (stmt, i);
29   gimple_op (stmt, 1);
30 }
31 
32 /* The test which bypasses the loop is simplified prior to DOM to check
33    that stmt->num_ops - 3 != 0.  When that test is false, we can derive
34    a value for stmt->num_ops.  That in turn allows us to thread the jump
35    for the conditional at the start of the call to gimple_op.  */
36 /* { dg-final { scan-tree-dump-times "Threaded" 1 "dom2"} } */
37