1396831ac1593bfdd1c4aa17321520eb2e077c13
[gcc.git] / gcc / testsuite / gcc.dg / tree-ssa / ssa-dom-thread-4.c
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-dom1-details" } */
3 /* { dg-additional-options "-mbranch-cost=2" { target s390*-*-* } } */
4 struct bitmap_head_def;
5 typedef struct bitmap_head_def *bitmap;
6 typedef const struct bitmap_head_def *const_bitmap;
7 typedef unsigned long BITMAP_WORD;
8 typedef struct bitmap_element_def
9 {
10 struct bitmap_element_def *next;
11 unsigned int indx;
12 } bitmap_element;
13
14
15
16
17
18
19
20
21
22 unsigned char
23 bitmap_ior_and_compl (bitmap dst, const_bitmap a, const_bitmap b,
24 const_bitmap kill)
25 {
26 unsigned char changed = 0;
27
28 bitmap_element *dst_elt;
29 const bitmap_element *a_elt, *b_elt, *kill_elt, *dst_prev;
30
31 while (a_elt || b_elt)
32 {
33 unsigned char new_element = 0;
34
35 if (b_elt)
36 while (kill_elt && kill_elt->indx < b_elt->indx)
37 kill_elt = kill_elt->next;
38
39 if (b_elt && kill_elt && kill_elt->indx == b_elt->indx
40 && (!a_elt || a_elt->indx >= b_elt->indx))
41 {
42 bitmap_element tmp_elt;
43 unsigned ix;
44
45 BITMAP_WORD ior = 0;
46
47 changed = bitmap_elt_ior (dst, dst_elt, dst_prev,
48 a_elt, &tmp_elt, changed);
49
50 }
51
52 }
53
54
55 return changed;
56 }
57 /* The block starting the second conditional has 3 incoming edges,
58 we should thread all three, but due to a bug in the threading
59 code we missed the edge when the first conditional is false
60 (b_elt is zero, which means the second conditional is always
61 zero. */
62 /* { dg-final { scan-tree-dump-times "Threaded" 3 "dom1" { target { ! mips*-*-* } } } } */
63 /* MIPS defines LOGICAL_OP_NON_SHORT_CIRCUIT to 0, so we split var1 || var2
64 into two conditions, rather than use (var1 != 0) | (var2 != 0). */
65 /* { dg-final { scan-tree-dump-times "Threaded" 4 "dom1" { target mips*-*-* } } } */
66 /* { dg-final { cleanup-tree-dump "dom1" } } */
67