diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-02 11:53:08 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-07-02 11:53:08 +0000 |
commit | c8ca3ee74d46c0ab8fef2e438d731dcf3b28a3eb (patch) | |
tree | 3d0ceb6622e9dd1148a3d0ed7aa630d1fae0d3e8 /gcc/gimplify.c | |
parent | 6c7d78e4edbdff03f939d4994e86c62727d37a83 (diff) | |
download | gcc-c8ca3ee74d46c0ab8fef2e438d731dcf3b28a3eb.tar.gz |
2007-07-02 Richard Guenther <rguenther@suse.de>
* tree-flow.h (types_compatible_p): Declare.
* tree-ssa.c (types_compatible_p): New function.
* ipa-type-escape.c (discover_unique_type): Use
types_compatible_p instead of lang_hooks.types_compatible_p.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-vn.c (expressions_equal_p): Likewise.
* tree.c (fields_compatible_p): Likewise.
* tree-ssa-dom.c (avail_expr_eq): Likewise.
(cprop_operand): Use useless_type_conversion_p instead of
lang_hooks.types_compatible_p.
* tree-inline.c (setup_one_parameter): Likewise.
(declare_return_variable): Likewise.
* tree-nrv.c (tree_nrv): Likewise.
* tree-ssa-ccp.c (maybe_fold_offset_to_array_ref): Likewise.
(maybe_fold_offset_to_component_ref): Likewise.
(maybe_fold_offset_to_reference): Likewise.
* tree-ssa-copy.c (may_propagate_copy): Likewise.
(merge_alias_info): Likewise.
* tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Likewise.
* tree-ssa-phiopt.c (conditional_replacement): Likewise.
* tree-ssa-reassoc.c (optimize_ops_list): Likewise.
* tree-tailcall.c (find_tail_calls): Likewise.
* tree-vect-generic.c (expand_vector_operations_1): Likewise.
* gimplify.c (canonicalize_addr_expr): Likewise.
(fold_indirect_ref_rhs): Likewise.
(gimplify_addr_expr): Likewise. Swap parameters to cpt_same_type.
(cpt_same_type): Likewise.
(check_pointer_types_r): Swap parameters to cpt_same_type
where appropriate.
* fold-const.c (fold_convert): Revert fix for PR15988.
* tree-inline.c (setup_one_parameter): Instead fix it here by
using fold_build1 instead of fold_convert and checking for
error_mark_node. Convert only if the conversion is necessary.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@126198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimplify.c')
-rw-r--r-- | gcc/gimplify.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a7669acc968..5510f6008db 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1599,13 +1599,13 @@ canonicalize_addr_expr (tree *expr_p) /* Both cast and addr_expr types should address the same object type. */ dctype = TREE_TYPE (ctype); ddatype = TREE_TYPE (datype); - if (!lang_hooks.types_compatible_p (ddatype, dctype)) + if (!useless_type_conversion_p (dctype, ddatype)) return; /* The addr_expr and the object type should match. */ obj_expr = TREE_OPERAND (addr_expr, 0); otype = TREE_TYPE (obj_expr); - if (!lang_hooks.types_compatible_p (otype, datype)) + if (!useless_type_conversion_p (datype, otype)) return; /* The lower bound and element sizes must be constant. */ @@ -3304,11 +3304,11 @@ fold_indirect_ref_rhs (tree t) tree op = TREE_OPERAND (sub, 0); tree optype = TREE_TYPE (op); /* *&p => p */ - if (lang_hooks.types_compatible_p (type, optype)) + if (useless_type_conversion_p (type, optype)) return op; /* *(foo *)&fooarray => fooarray[0] */ else if (TREE_CODE (optype) == ARRAY_TYPE - && lang_hooks.types_compatible_p (type, TREE_TYPE (optype))) + && useless_type_conversion_p (type, TREE_TYPE (optype))) { tree type_domain = TYPE_DOMAIN (optype); tree min_val = size_zero_node; @@ -3320,7 +3320,7 @@ fold_indirect_ref_rhs (tree t) /* *(foo *)fooarrptr => (*fooarrptr)[0] */ if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE - && lang_hooks.types_compatible_p (type, TREE_TYPE (TREE_TYPE (subtype)))) + && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (subtype)))) { tree type_domain; tree min_val = size_zero_node; @@ -3974,14 +3974,15 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p) tree t_expr = TREE_TYPE (expr); tree t_op00 = TREE_TYPE (op00); - if (!lang_hooks.types_compatible_p (t_expr, t_op00)) + if (!useless_type_conversion_p (t_expr, t_op00)) { #ifdef ENABLE_CHECKING tree t_op0 = TREE_TYPE (op0); gcc_assert (POINTER_TYPE_P (t_expr) - && cpt_same_type (TREE_CODE (t_op0) == ARRAY_TYPE - ? TREE_TYPE (t_op0) : t_op0, - TREE_TYPE (t_expr)) + && (cpt_same_type (TREE_TYPE (t_expr), t_op0) + || (TREE_CODE (t_op0) == ARRAY_TYPE + && cpt_same_type (TREE_TYPE (t_expr), + TREE_TYPE (t_op0)))) && POINTER_TYPE_P (t_op00) && cpt_same_type (t_op0, TREE_TYPE (t_op00))); #endif @@ -6385,7 +6386,7 @@ gimplify_one_sizepos (tree *expr_p, tree *stmt_p) static bool cpt_same_type (tree a, tree b) { - if (lang_hooks.types_compatible_p (a, b)) + if (useless_type_conversion_p (a, b)) return true; /* ??? The C++ FE decomposes METHOD_TYPES to FUNCTION_TYPES and doesn't @@ -6436,7 +6437,7 @@ check_pointer_types_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, ptype = TREE_TYPE (t); otype = TREE_TYPE (TREE_OPERAND (t, 0)); dtype = TREE_TYPE (ptype); - if (!cpt_same_type (otype, dtype)) + if (!cpt_same_type (dtype, otype)) { /* &array is allowed to produce a pointer to the element, rather than a pointer to the array type. We must allow this in order to @@ -6444,7 +6445,7 @@ check_pointer_types_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, pointer to the element type. */ gcc_assert (TREE_CODE (otype) == ARRAY_TYPE && POINTER_TYPE_P (ptype) - && cpt_same_type (TREE_TYPE (otype), dtype)); + && cpt_same_type (dtype, TREE_TYPE (otype))); break; } break; |