1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-vrp1-details -fdump-tree-dom2-details -std=gnu89" } */
3 struct bitmap_head_def
;
4 typedef struct bitmap_head_def
*bitmap
;
5 typedef const struct bitmap_head_def
*const_bitmap
;
6 typedef unsigned long BITMAP_WORD
;
7 typedef struct bitmap_element_def
9 struct bitmap_element_def
*next
;
22 bitmap_ior_and_compl (bitmap dst
, const_bitmap a
, const_bitmap b
,
25 unsigned char changed
= 0;
27 bitmap_element
*dst_elt
;
28 const bitmap_element
*a_elt
, *b_elt
, *kill_elt
, *dst_prev
;
30 while (a_elt
|| b_elt
)
32 unsigned char new_element
= 0;
35 while (kill_elt
&& kill_elt
->indx
< b_elt
->indx
)
36 kill_elt
= kill_elt
->next
;
38 if (b_elt
&& kill_elt
&& kill_elt
->indx
== b_elt
->indx
39 && (!a_elt
|| a_elt
->indx
>= b_elt
->indx
))
41 bitmap_element tmp_elt
;
46 changed
= bitmap_elt_ior (dst
, dst_elt
, dst_prev
,
47 a_elt
, &tmp_elt
, changed
);
56 /* The block starting the second conditional has 3 incoming edges,
57 we should thread all three, but due to a bug in the threading
58 code we missed the edge when the first conditional is false
59 (b_elt is zero, which means the second conditional is always
60 zero. VRP1 catches all three. */
61 /* { dg-final { scan-tree-dump-times "Threaded" 3 "vrp1" { target { ! logical_op_short_circuit } } } } */
63 /* On targets that define LOGICAL_OP_NON_SHORT_CIRCUIT to 0, we split both
64 "a_elt || b_elt" and "b_elt && kill_elt" into two conditions each,
65 rather than using "(var1 != 0) op (var2 != 0)". Also, as on other targets,
66 we duplicate the header of the inner "while" loop. There are then
67 4 threading opportunities:
69 1x "!a_elt && b_elt" in the outer "while" loop
70 -> the start of the inner "while" loop,
71 skipping the known-true "b_elt" in the first condition.
72 1x "!b_elt" in the first condition
73 -> the outer "while" loop's continuation point,
74 skipping the known-false "b_elt" in the second condition.
75 2x "kill_elt->indx >= b_elt->indx" in the first "while" loop
76 -> "kill_elt->indx == b_elt->indx" in the second condition,
77 skipping the known-true "b_elt && kill_elt" in the second
80 All the cases are picked up by VRP1 as jump threads. */
81 /* { dg-final { scan-tree-dump-times "Threaded" 4 "vrp1" { target logical_op_short_circuit } } } */