Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/ssa-thread-19.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-threadfull1-stats" } */
3
4 struct S;
5 struct S { struct S *next; };
6 int foo (struct S *chain, _Bool is_ctor, _Bool is_dtor)
7 {
8 int num_args = 0;
9 if (chain) /* A */
10 {
11 do {
12 num_args++;
13 chain = chain->next;
14 if (!chain)
15 break;
16 } while (1);
17 }
18 if (is_ctor)
19 num_args++; /* B */
20 if (is_dtor)
21 num_args++;
22 else
23 {
24 if (num_args > 2) /* C */
25 __builtin_puts ("x");
26 }
27 return num_args;
28 }
29
30 /* We want to thread both paths from A with NULL chain to C, the one through
31 B and one around it.
32 ??? Ideally we'd thread one "path" containing the half-diamond with B. */
33 /* { dg-final { scan-tree-dump "Jumps threaded: 2" "threadfull1" } } */