-/* Returns true if A and B are accesses to different objects, or to different
- fields of the same object. */
-
-static bool
-disjoint_objects_p (tree a, tree b)
-{
- tree base_a, base_b;
- VEC (tree, heap) *comp_a = NULL, *comp_b = NULL;
- bool ret;
-
- base_a = get_base_address (a);
- base_b = get_base_address (b);
-
- if (DECL_P (base_a)
- && DECL_P (base_b)
- && base_a != base_b)
- return true;
-
- if (!operand_equal_p (base_a, base_b, 0))
- return false;
-
- /* Compare the component references of A and B. We must start from the inner
- ones, so record them to the vector first. */
- while (handled_component_p (a))
- {
- VEC_safe_push (tree, heap, comp_a, a);
- a = TREE_OPERAND (a, 0);
- }
- while (handled_component_p (b))
- {
- VEC_safe_push (tree, heap, comp_b, b);
- b = TREE_OPERAND (b, 0);
- }
-
- ret = false;
- while (1)
- {
- if (VEC_length (tree, comp_a) == 0
- || VEC_length (tree, comp_b) == 0)
- break;
-
- a = VEC_pop (tree, comp_a);
- b = VEC_pop (tree, comp_b);
-
- /* Real and imaginary part of a variable do not alias. */
- if ((TREE_CODE (a) == REALPART_EXPR
- && TREE_CODE (b) == IMAGPART_EXPR)
- || (TREE_CODE (a) == IMAGPART_EXPR
- && TREE_CODE (b) == REALPART_EXPR))
- {
- ret = true;
- break;
- }
-
- if (TREE_CODE (a) != TREE_CODE (b))
- break;
-
- /* Nothing to do for ARRAY_REFs, as the indices of array_refs in
- DR_BASE_OBJECT are always zero. */
- if (TREE_CODE (a) == ARRAY_REF)
- continue;
- else if (TREE_CODE (a) == COMPONENT_REF)
- {
- if (operand_equal_p (TREE_OPERAND (a, 1), TREE_OPERAND (b, 1), 0))
- continue;
-
- /* Different fields of unions may overlap. */
- base_a = TREE_OPERAND (a, 0);
- if (TREE_CODE (TREE_TYPE (base_a)) == UNION_TYPE)
- break;
-
- /* Different fields of structures cannot. */
- ret = true;
- break;
- }
- else
- break;
- }
-
- VEC_free (tree, heap, comp_a);
- VEC_free (tree, heap, comp_b);
-
- return ret;
-}
-