1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fno-strict-aliasing -fdump-ipa-sra-details -fdump-tree-optimized" } */
13 unsigned int xa_flags
;
19 struct list_head
*next
, *prev
;
22 struct callback_head
{
23 struct callback_head
*next
;
24 void (*func
)(struct callback_head
*head
);
25 } __attribute__((aligned(sizeof(void *))));
31 unsigned char nr_values
;
32 struct xa_node
*parent
;
35 struct list_head private_list
;
36 struct callback_head callback_head
;
38 void *slots
[(1UL << (0 ? 4 : 6))];
40 unsigned long tags
[3][((((1UL << (0 ? 4 : 6))) + (64) - 1) / (64))];
41 unsigned long marks
[3][((((1UL << (0 ? 4 : 6))) + (64) - 1) / (64))];
45 static inline __attribute__((__gnu_inline__
)) __attribute__((__unused__
)) __attribute__((no_instrument_function
)) unsigned long shift_maxindex(unsigned int shift
)
47 return ((1UL << (0 ? 4 : 6)) << shift
) - 1;
50 static inline __attribute__((__gnu_inline__
)) __attribute__((__unused__
)) __attribute__((no_instrument_function
)) unsigned long node_maxindex(const struct xa_node
*node
)
52 return shift_maxindex(node
->shift
);
55 static inline __attribute__((__gnu_inline__
)) __attribute__((__unused__
)) __attribute__((no_instrument_function
)) struct xa_node
*entry_to_node(void *ptr
)
57 return (void *)((__UINTPTR_TYPE__
)ptr
& ~(__UINTPTR_TYPE__
)2);
60 static inline __attribute__((__gnu_inline__
)) __attribute__((__unused__
)) __attribute__((no_instrument_function
)) bool radix_tree_is_internal_node(void *ptr
)
62 return ((__UINTPTR_TYPE__
)ptr
& 3UL) ==
66 static inline __attribute__((__gnu_inline__
)) __attribute__((__unused__
)) __attribute__((no_instrument_function
)) void *xa_mk_internal(__UINTPTR_TYPE__ v
)
68 return (void *)((v
<< 2) | 2);
71 static unsigned radix_tree_load_root(const struct xarray
*root
,
72 struct xa_node
**nodep
, unsigned long *maxindex
)
74 struct xa_node
*node
=
76 typeof(root
->xa_head
) ________p1
= ({(*(const volatile typeof(root
->xa_head
) *)&(root
->xa_head
)); });
77 ((typeof(*root
->xa_head
) *)(________p1
));
82 if (__builtin_expect(!!(radix_tree_is_internal_node(node
)), 1)) {
83 node
= entry_to_node(node
);
84 *maxindex
= node_maxindex(node
);
85 return node
->shift
+ (0 ? 4 : 6);
92 void *__radix_tree_lookup(const struct xarray
*root
,
93 unsigned long index
, struct xa_node
**nodep
,
96 struct xa_node
*node
, *parent
;
97 unsigned long maxindex
;
100 parent
= ((void *)0);
101 radix_tree_load_root(root
, &node
, &maxindex
);
102 while (radix_tree_is_internal_node(node
)) {
104 parent
= entry_to_node(node
);
105 if (node
== xa_mk_internal(256))
107 if (parent
->shift
== 0)
116 /* { dg-final { scan-ipa-dump-not "IPA_PARAM_OP_SPLIT" "sra" } } */
117 /* { dg-final { scan-tree-dump " ={v} " "optimized" } } */