From 1c1f1bc0ab7e9b35d4dd92a983a0c72ba215cb2d Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 29 Jun 2009 12:23:21 +0000 Subject: 2009-06-29 Richard Guenther PR middle-end/14187 * tree-ssa-alias.h (struct pt_solution): Add vars_contains_restrict flag. (pt_solutions_same_restrict_base): Declare. * tree-ssa-structalias.c (struct variable_info): Add is_restrict_var flag. (new_var_info): Initialize is_global_var properly for SSA_NAMEs. (make_constraint_from, make_copy_constraint): Move earlier. (make_constraint_from_heapvar): New function. (make_constraint_from_restrict): Likewise. (handle_lhs_call): Use it. (find_func_aliases): Use it to track conversions to restrict qualified pointers. (struct fieldoff): Add only_restrict_pointers flag. (push_fields_onto_fieldstack): Initialize it. (create_variable_info_for): Track global restrict qualified pointers. (intra_create_variable_infos): Use make_constraint_from_heapvar. Track restrict qualified pointer arguments. (set_uids_in_ptset): Use varinfo is_global_var flag. (find_what_var_points_to): Set the vars_contains_restrict flag. Always create the points-to solution for sets including restrict tags. (pt_solutions_same_restrict_base): New function. * tree-ssa-alias.c (ptr_derefs_may_alias_p): For two restrict qualified pointers use pt_solutions_same_restrict_base as additional source for disambiguation. * gcc.dg/tree-ssa/restrict-1.c: New testcase. * gcc.dg/tree-ssa/restrict-2.c: Likewise. * gcc.dg/tree-ssa/restrict-3.c: Likewise. * gcc.c-torture/execute/20090623-1.c: Likewise. * gcc.dg/tree-ssa/ldist-13.c: Likewise. * gcc.dg/tree-ssa/ldist-14.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149048 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 14733675262..e8bca84ba35 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -273,6 +273,13 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) if (!pi1 || !pi2) return true; + /* If both pointers are restrict-qualified try to disambiguate + with restrict information. */ + if (TYPE_RESTRICT (TREE_TYPE (ptr1)) + && TYPE_RESTRICT (TREE_TYPE (ptr2)) + && !pt_solutions_same_restrict_base (&pi1->pt, &pi2->pt)) + return false; + /* ??? This does not use TBAA to prune decls from the intersection that not both pointers may access. */ return pt_solutions_intersect (&pi1->pt, &pi2->pt); -- cgit v1.2.1 From 1daead670209600896b7d063704b432954cd505f Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 30 Jun 2009 09:55:34 +0000 Subject: 2009-06-30 Richard Guenther * tree-ssa-alias.c (walk_aliased_vdefs_1): Change interface to use ao_ref references. (walk_aliased_vdefs): Likewise. * tree-ssa-alias.h (walk_aliased_vdefs): Adjust prototype. * tree-ssa-dce.c (struct ref_data): Remove. (mark_aliased_reaching_defs_necessary_1): Use the ao_ref argument. (mark_aliased_reaching_defs_necessary): Adjust. (mark_all_reaching_defs_necessary_1): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149086 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e8bca84ba35..4d721877d02 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1427,8 +1427,8 @@ walk_non_aliased_vuses (ao_ref *ref, tree vuse, The function returns the number of statements walked. */ static unsigned int -walk_aliased_vdefs_1 (tree ref, tree vdef, - bool (*walker)(tree, tree, void *), void *data, +walk_aliased_vdefs_1 (ao_ref *ref, tree vdef, + bool (*walker)(ao_ref *, tree, void *), void *data, bitmap *visited, unsigned int cnt) { do @@ -1455,7 +1455,7 @@ walk_aliased_vdefs_1 (tree ref, tree vdef, /* ??? Do we want to account this to TV_ALIAS_STMT_WALK? */ cnt++; if ((!ref - || stmt_may_clobber_ref_p (def_stmt, ref)) + || stmt_may_clobber_ref_p_1 (def_stmt, ref)) && (*walker) (ref, vdef, data)) return cnt; @@ -1465,8 +1465,8 @@ walk_aliased_vdefs_1 (tree ref, tree vdef, } unsigned int -walk_aliased_vdefs (tree ref, tree vdef, - bool (*walker)(tree, tree, void *), void *data, +walk_aliased_vdefs (ao_ref *ref, tree vdef, + bool (*walker)(ao_ref *, tree, void *), void *data, bitmap *visited) { bitmap local_visited = NULL; -- cgit v1.2.1 From 3a4438438e8c85036b3cf79cbbf030f0d726db88 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 14 Jul 2009 09:59:18 +0000 Subject: 2009-07-14 Richard Guenther Andrey Belevantsev * tree-ssa-alias.h (refs_may_alias_p_1): Declare. (pt_solution_set): Likewise. * tree-ssa-alias.c (refs_may_alias_p_1): Export. * tree-ssa-structalias.c (pt_solution_set): New function. * final.c (rest_of_clean_state): Free SSA data structures. * print-rtl.c (print_decl_name): Remove. (print_mem_expr): Implement in terms of print_generic_expr. * alias.c (ao_ref_from_mem): New function. (rtx_refs_may_alias_p): Likewise. (true_dependence): Query alias-export info. (canon_true_dependence): Likewise. (write_dependence_p): Likewise. * tree-dfa.c (get_ref_base_and_extent): For void types leave size unknown. * emit-rtl.c (component_ref_for_mem_expr): Remove. (mem_expr_equal_p): Use operand_equal_p. (set_mem_attributes_minus_bitpos): Do not use component_ref_for_mem_expr. * cfgexpand.c (add_partitioned_vars_to_ptset): New function. (update_alias_info_with_stack_vars): Likewise. (partition_stack_vars): Call update_alias_info_with_stack_vars. * tree-ssa.c (delete_tree_ssa): Do not release SSA names explicitly nor clear stmt operands. Free the decl-to-pointer map. * tree-optimize.c (execute_free_datastructures): Do not free SSA data structures here. * tree-flow.h (struct gimple_df): Add decls_to_pointers member. * Makefile.in (emit-rtl.o): Add pointer-set.h dependency. (alias.o): Add tree-ssa-alias.h, pointer-set.h and $(TREE_FLOW_H) dependencies. (print-rtl.o): Add $(DIAGNOSTIC_H) dependency. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149624 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 4d721877d02..92297fc6cf2 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -724,7 +724,7 @@ indirect_refs_may_alias_p (tree ref1, tree ptr1, /* Return true, if the two memory references REF1 and REF2 may alias. */ -static bool +bool refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) { tree base1, base2; -- cgit v1.2.1 From 4763217ec0b46b8da472dc3df65cb5dd35cf151d Mon Sep 17 00:00:00 2001 From: pinskia Date: Tue, 4 Aug 2009 22:45:33 +0000 Subject: 2009-08-04 Andrew Pinski * tree-ssa-alias.c: Fix some comment typos. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150470 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 92297fc6cf2..cabbf05fe59 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -578,8 +578,8 @@ nonaliasing_component_refs_p (tree ref1, tree type1, } /* Return true if two memory references based on the variables BASE1 - and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1[ and - [OFFSET2, OFFSET2 + MAX_SIZE2[ may alias. */ + and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1] and + [OFFSET2, OFFSET2 + MAX_SIZE2] may alias. */ static bool decl_refs_may_alias_p (tree base1, @@ -599,8 +599,8 @@ decl_refs_may_alias_p (tree base1, } /* Return true if an indirect reference based on *PTR1 constrained - to [OFFSET1, OFFSET1 + MAX_SIZE1[ may alias a variable based on BASE2 - constrained to [OFFSET2, OFFSET2 + MAX_SIZE2[. *PTR1 and BASE2 have + to [OFFSET1, OFFSET1 + MAX_SIZE1] may alias a variable based on BASE2 + constrained to [OFFSET2, OFFSET2 + MAX_SIZE2]. *PTR1 and BASE2 have the alias sets BASE1_ALIAS_SET and BASE2_ALIAS_SET which can be -1 in which case they are computed on-demand. REF1 and REF2 if non-NULL are the complete memory reference trees. */ @@ -662,8 +662,8 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, } /* Return true if two indirect references based on *PTR1 - and *PTR2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1[ and - [OFFSET2, OFFSET2 + MAX_SIZE2[ may alias. *PTR1 and *PTR2 have + and *PTR2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1] and + [OFFSET2, OFFSET2 + MAX_SIZE2] may alias. *PTR1 and *PTR2 have the alias sets BASE1_ALIAS_SET and BASE2_ALIAS_SET which can be -1 in which case they are computed on-demand. REF1 and REF2 if non-NULL are the complete memory reference trees. */ -- cgit v1.2.1 From 077ad5adc3dfba339db1bb33ba59cc4a85ad7ed4 Mon Sep 17 00:00:00 2001 From: pinskia Date: Wed, 5 Aug 2009 17:20:33 +0000 Subject: 2009-08-05 Andrew Pinski * tree-ssa-alias.c: Fix intervals to use [) syntax. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150496 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index cabbf05fe59..acfdcae0c0c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -578,8 +578,8 @@ nonaliasing_component_refs_p (tree ref1, tree type1, } /* Return true if two memory references based on the variables BASE1 - and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1] and - [OFFSET2, OFFSET2 + MAX_SIZE2] may alias. */ + and BASE2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and + [OFFSET2, OFFSET2 + MAX_SIZE2) may alias. */ static bool decl_refs_may_alias_p (tree base1, @@ -599,8 +599,8 @@ decl_refs_may_alias_p (tree base1, } /* Return true if an indirect reference based on *PTR1 constrained - to [OFFSET1, OFFSET1 + MAX_SIZE1] may alias a variable based on BASE2 - constrained to [OFFSET2, OFFSET2 + MAX_SIZE2]. *PTR1 and BASE2 have + to [OFFSET1, OFFSET1 + MAX_SIZE1) may alias a variable based on BASE2 + constrained to [OFFSET2, OFFSET2 + MAX_SIZE2). *PTR1 and BASE2 have the alias sets BASE1_ALIAS_SET and BASE2_ALIAS_SET which can be -1 in which case they are computed on-demand. REF1 and REF2 if non-NULL are the complete memory reference trees. */ @@ -662,8 +662,8 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, } /* Return true if two indirect references based on *PTR1 - and *PTR2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1] and - [OFFSET2, OFFSET2 + MAX_SIZE2] may alias. *PTR1 and *PTR2 have + and *PTR2 constrained to [OFFSET1, OFFSET1 + MAX_SIZE1) and + [OFFSET2, OFFSET2 + MAX_SIZE2) may alias. *PTR1 and *PTR2 have the alias sets BASE1_ALIAS_SET and BASE2_ALIAS_SET which can be -1 in which case they are computed on-demand. REF1 and REF2 if non-NULL are the complete memory reference trees. */ -- cgit v1.2.1 From 134899ace5a4147e3cc950750641719d2110f2a9 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 30 Aug 2009 11:52:13 +0000 Subject: 2009-08-30 Richard Guenther PR tree-optimization/41186 * tree-ssa-alias.c (ptr_deref_may_alias_ref_p): Remove. (ao_ref_init_from_ptr_and_size): New function. (ref_maybe_used_by_call_p_1): Be more precise tracking used ranges for builtin functions. (ref_maybe_used_by_call_p): Adjust. (call_may_clobber_ref_p_1): Be more precise tracking clobbered ranges for builtin functions. * tree-ssa-alias.h (ao_ref_init_from_ptr_and_size): Declare. * g++.dg/torture/pr41186.C: New testcase. * g++.dg/tree-ssa/pr41186.C: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151226 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 79 +++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 59 insertions(+), 20 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index acfdcae0c0c..7e83a84b82c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -302,14 +302,6 @@ ptr_deref_may_alias_ref_p_1 (tree ptr, ao_ref *ref) return true; } -static bool -ptr_deref_may_alias_ref_p (tree ptr, tree ref) -{ - ao_ref r; - ao_ref_init (&r, ref); - return ptr_deref_may_alias_ref_p_1 (ptr, &r); -} - /* Dump alias information on FILE. */ @@ -490,6 +482,34 @@ ao_ref_alias_set (ao_ref *ref) return ref->ref_alias_set; } +/* Init an alias-oracle reference representation from a gimple pointer + PTR and a gimple size SIZE in bytes. If SIZE is NULL_TREE the the + size is assumed to be unknown. The access is assumed to be only + to or after of the pointer target, not before it. */ + +void +ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size) +{ + HOST_WIDE_INT t1, t2; + ref->ref = NULL_TREE; + if (TREE_CODE (ptr) == ADDR_EXPR) + ref->base = get_ref_base_and_extent (TREE_OPERAND (ptr, 0), + &ref->offset, &t1, &t2); + else + { + ref->base = build1 (INDIRECT_REF, char_type_node, ptr); + ref->offset = 0; + } + if (size + && host_integerp (size, 0) + && TREE_INT_CST_LOW (size) * 8 / 8 == TREE_INT_CST_LOW (size)) + ref->max_size = ref->size = TREE_INT_CST_LOW (size) * 8; + else + ref->max_size = ref->size = -1; + ref->ref_alias_set = 0; + ref->base_alias_set = 0; +} + /* Return 1 if TYPE1 and TYPE2 are to be considered equivalent for the purpose of TBAA. Return 0 if they are distinct and -1 if we cannot decide. */ @@ -854,7 +874,7 @@ refs_output_dependent_p (tree store1, tree store2) otherwise return false. */ static bool -ref_maybe_used_by_call_p_1 (gimple call, tree ref) +ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) { tree base, callee; unsigned i; @@ -865,7 +885,7 @@ ref_maybe_used_by_call_p_1 (gimple call, tree ref) && (flags & (ECF_CONST|ECF_NOVOPS))) goto process_args; - base = get_base_address (ref); + base = ao_ref_base (ref); if (!base) return true; @@ -899,8 +919,14 @@ ref_maybe_used_by_call_p_1 (gimple call, tree ref) case BUILT_IN_STRCAT: case BUILT_IN_STRNCAT: { - tree src = gimple_call_arg (call, 1); - return ptr_deref_may_alias_ref_p (src, ref); + ao_ref dref; + tree size = NULL_TREE; + if (gimple_call_num_args (call) == 3) + size = gimple_call_arg (call, 2); + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 1), + size); + return refs_may_alias_p_1 (&dref, ref, false); } /* The following builtins do not read from memory. */ case BUILT_IN_FREE: @@ -1004,9 +1030,13 @@ process_args: op = TREE_OPERAND (op, 0); if (TREE_CODE (op) != SSA_NAME - && !is_gimple_min_invariant (op) - && refs_may_alias_p (op, ref)) - return true; + && !is_gimple_min_invariant (op)) + { + ao_ref r; + ao_ref_init (&r, op); + if (refs_may_alias_p_1 (&r, ref, true)) + return true; + } } return false; @@ -1015,7 +1045,10 @@ process_args: static bool ref_maybe_used_by_call_p (gimple call, tree ref) { - bool res = ref_maybe_used_by_call_p_1 (call, ref); + ao_ref r; + bool res; + ao_ref_init (&r, ref); + res = ref_maybe_used_by_call_p_1 (call, &r); if (res) ++alias_stats.ref_maybe_used_by_call_p_may_alias; else @@ -1106,15 +1139,21 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) case BUILT_IN_STPNCPY: case BUILT_IN_STRCAT: case BUILT_IN_STRNCAT: + case BUILT_IN_MEMSET: { - tree dest = gimple_call_arg (call, 0); - return ptr_deref_may_alias_ref_p_1 (dest, ref); + ao_ref dref; + tree size = NULL_TREE; + if (gimple_call_num_args (call) == 3) + size = gimple_call_arg (call, 2); + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 0), + size); + return refs_may_alias_p_1 (&dref, ref, false); } /* Freeing memory kills the pointed-to memory. More importantly the call has to serve as a barrier for moving loads and stores - across it. Same is true for memset. */ + across it. */ case BUILT_IN_FREE: - case BUILT_IN_MEMSET: { tree ptr = gimple_call_arg (call, 0); return ptr_deref_may_alias_ref_p_1 (ptr, ref); -- cgit v1.2.1 From e49a981971dab0bad9ee48e9c5a3bd0691d63159 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 31 Aug 2009 12:52:17 +0000 Subject: 2009-08-31 Richard Guenther * builtins.c (fold_builtin_memory_op): Use the alias oracle to query if the memory regions for memmove overlap. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Relax the asserts on pointers, instead deal with odd trees. (ptr_derefs_may_alias_p): Likewise. (refs_may_alias_p_1): Constructor bases also never alias. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151241 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 7e83a84b82c..14f1fb47006 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -168,12 +168,9 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) { struct ptr_info_def *pi; - gcc_assert ((TREE_CODE (ptr) == SSA_NAME - || TREE_CODE (ptr) == ADDR_EXPR - || TREE_CODE (ptr) == INTEGER_CST) - && (TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == PARM_DECL - || TREE_CODE (decl) == RESULT_DECL)); + gcc_assert (TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == PARM_DECL + || TREE_CODE (decl) == RESULT_DECL); /* Non-aliased variables can not be pointed to. */ if (!may_be_aliased (decl)) @@ -197,9 +194,9 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) return true; } - /* We can end up with dereferencing constant pointers. + /* We can end up with dereferencing non-SSA name pointers. Just bail out in this case. */ - if (TREE_CODE (ptr) == INTEGER_CST) + if (TREE_CODE (ptr) != SSA_NAME) return true; /* If we do not have useful points-to information for this pointer @@ -220,13 +217,6 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) { struct ptr_info_def *pi1, *pi2; - gcc_assert ((TREE_CODE (ptr1) == SSA_NAME - || TREE_CODE (ptr1) == ADDR_EXPR - || TREE_CODE (ptr1) == INTEGER_CST) - && (TREE_CODE (ptr2) == SSA_NAME - || TREE_CODE (ptr2) == ADDR_EXPR - || TREE_CODE (ptr2) == INTEGER_CST)); - /* ADDR_EXPR pointers either just offset another pointer or directly specify the pointed-to set. */ if (TREE_CODE (ptr1) == ADDR_EXPR) @@ -254,10 +244,10 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) return true; } - /* We can end up with dereferencing constant pointers. + /* We can end up with dereferencing non-SSA name pointers. Just bail out in this case. */ - if (TREE_CODE (ptr1) == INTEGER_CST - || TREE_CODE (ptr2) == INTEGER_CST) + if (TREE_CODE (ptr1) != SSA_NAME + || TREE_CODE (ptr2) != SSA_NAME) return true; /* We may end up with two empty points-to solutions for two same pointers. @@ -781,7 +771,9 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) if (TREE_CODE (base1) == SSA_NAME || TREE_CODE (base2) == SSA_NAME || is_gimple_min_invariant (base1) - || is_gimple_min_invariant (base2)) + || is_gimple_min_invariant (base2) + || TREE_CODE (base1) == CONSTRUCTOR + || TREE_CODE (base2) == CONSTRUCTOR) return false; /* Defer to simple offset based disambiguation if we have -- cgit v1.2.1 From f85fb8196d7727fb5c14a7fa86dd7ab7768b5812 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 2 Sep 2009 11:58:27 +0000 Subject: 2009-09-02 Richard Guenther Revert 2009-08-31 Richard Guenther * builtins.c (fold_builtin_memory_op): Use the alias oracle to query if the memory regions for memmove overlap. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Relax the asserts on pointers, instead deal with odd trees. (ptr_derefs_may_alias_p): Likewise. (refs_may_alias_p_1): Constructor bases also never alias. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151320 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 14f1fb47006..7e83a84b82c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -168,9 +168,12 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) { struct ptr_info_def *pi; - gcc_assert (TREE_CODE (decl) == VAR_DECL - || TREE_CODE (decl) == PARM_DECL - || TREE_CODE (decl) == RESULT_DECL); + gcc_assert ((TREE_CODE (ptr) == SSA_NAME + || TREE_CODE (ptr) == ADDR_EXPR + || TREE_CODE (ptr) == INTEGER_CST) + && (TREE_CODE (decl) == VAR_DECL + || TREE_CODE (decl) == PARM_DECL + || TREE_CODE (decl) == RESULT_DECL)); /* Non-aliased variables can not be pointed to. */ if (!may_be_aliased (decl)) @@ -194,9 +197,9 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) return true; } - /* We can end up with dereferencing non-SSA name pointers. + /* We can end up with dereferencing constant pointers. Just bail out in this case. */ - if (TREE_CODE (ptr) != SSA_NAME) + if (TREE_CODE (ptr) == INTEGER_CST) return true; /* If we do not have useful points-to information for this pointer @@ -217,6 +220,13 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) { struct ptr_info_def *pi1, *pi2; + gcc_assert ((TREE_CODE (ptr1) == SSA_NAME + || TREE_CODE (ptr1) == ADDR_EXPR + || TREE_CODE (ptr1) == INTEGER_CST) + && (TREE_CODE (ptr2) == SSA_NAME + || TREE_CODE (ptr2) == ADDR_EXPR + || TREE_CODE (ptr2) == INTEGER_CST)); + /* ADDR_EXPR pointers either just offset another pointer or directly specify the pointed-to set. */ if (TREE_CODE (ptr1) == ADDR_EXPR) @@ -244,10 +254,10 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) return true; } - /* We can end up with dereferencing non-SSA name pointers. + /* We can end up with dereferencing constant pointers. Just bail out in this case. */ - if (TREE_CODE (ptr1) != SSA_NAME - || TREE_CODE (ptr2) != SSA_NAME) + if (TREE_CODE (ptr1) == INTEGER_CST + || TREE_CODE (ptr2) == INTEGER_CST) return true; /* We may end up with two empty points-to solutions for two same pointers. @@ -771,9 +781,7 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) if (TREE_CODE (base1) == SSA_NAME || TREE_CODE (base2) == SSA_NAME || is_gimple_min_invariant (base1) - || is_gimple_min_invariant (base2) - || TREE_CODE (base1) == CONSTRUCTOR - || TREE_CODE (base2) == CONSTRUCTOR) + || is_gimple_min_invariant (base2)) return false; /* Defer to simple offset based disambiguation if we have -- cgit v1.2.1 From ceefbccc7abbb43b69193ef5cd663be96f1b4b87 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 6 Sep 2009 16:48:41 +0000 Subject: 2009-09-06 Richard Guenther PR middle-end/41261 * tree-ssa-alias.c (refs_may_alias_p_1): Bail out for function decls. * gcc.dg/torture/pr41261.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151460 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 7e83a84b82c..89804a923b1 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -784,6 +784,12 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) || is_gimple_min_invariant (base2)) return false; + /* We can end up refering to code via function decls. As we likely + do not properly track code aliases conservatively bail out. */ + if (TREE_CODE (base1) == FUNCTION_DECL + || TREE_CODE (base2) == FUNCTION_DECL) + return true; + /* Defer to simple offset based disambiguation if we have references based on two decls. Do this before defering to TBAA to handle must-alias cases in conformance with the -- cgit v1.2.1 From e38def9ca7953bb5611d08ce8617249516ba5a99 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 14 Sep 2009 19:18:58 +0000 Subject: Squash commit of EH in gimple git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151696 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 89804a923b1..9522b28c548 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1028,10 +1028,6 @@ process_args: { tree op = gimple_call_arg (call, i); - if (TREE_CODE (op) == EXC_PTR_EXPR - || TREE_CODE (op) == FILTER_EXPR) - continue; - if (TREE_CODE (op) == WITH_SIZE_EXPR) op = TREE_OPERAND (op, 0); -- cgit v1.2.1 From 8bb76364adb500f539b7bbd329b83e4602bf839b Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 16 Sep 2009 16:12:18 +0000 Subject: PR fortran/41212 * tree.h (struct tree_decl_common): Add decl_restricted_flag, shorten decl_common_unused. (DECL_RESTRICTED_P): New accessor. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Use it to disambiguate marked decls and restrict pointers. fortran/ * trans.h (struct lang_type): Remove nontarget_type member. * trans.c (gfc_add_modify): Don't access it. * trans-decl.c (gfc_finish_var_decl): Don't allocate and set it, instead set DECL_RESTRICTED_P on affected decls. testsuite/ * gfortran.dg/pr41212.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151761 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 9522b28c548..e619190386c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -208,6 +208,14 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) if (!pi) return true; + /* If the decl can be used as a restrict tag and we have a restrict + pointer and that pointers points-to set doesn't contain this decl + then they can't alias. */ + if (DECL_RESTRICTED_P (decl) + && TYPE_RESTRICT (TREE_TYPE (ptr)) + && pi->pt.vars_contains_restrict) + return bitmap_bit_p (pi->pt.vars, DECL_UID (decl)); + return pt_solution_includes (&pi->pt, decl); } -- cgit v1.2.1 From a42ce2cca05f11caf1d19dd617ccddc2518fa577 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sat, 24 Oct 2009 10:05:23 +0000 Subject: * tree-ssa-alias.c (nonaliasing_component_refs_p): Rename into... (aliasing_component_refs_p): ...this. Return true if there is no common base and the base access types have the same alias set. (indirect_ref_may_alias_decl_p): Adjust for above renaming. (indirect_refs_may_alias_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153523 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e619190386c..ba5cbbc9488 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -553,10 +553,10 @@ same_type_for_tbaa (tree type1, tree type2) on an indirect reference may alias. */ static bool -nonaliasing_component_refs_p (tree ref1, tree type1, - HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, - tree ref2, tree type2, - HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2) +aliasing_component_refs_p (tree ref1, tree type1, + HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, + tree ref2, tree type2, + HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2) { /* If one reference is a component references through pointers try to find a common base and apply offset based disambiguation. This handles @@ -600,9 +600,19 @@ nonaliasing_component_refs_p (tree ref1, tree type1, offset1 -= offadj; return ranges_overlap_p (offset1, max_size1, offset2, max_size2); } - /* If we have two type access paths B1.path1 and B2.path2 they may - only alias if either B1 is in B2.path2 or B2 is in B1.path1. */ - return false; + + /* We haven't found any common base to apply offset-based disambiguation. + There are two cases: + 1. The base access types have the same alias set. This can happen + in Ada when a function with an unconstrained parameter passed by + reference is called on a constrained object and inlined: the types + have the same alias set but aren't equivalent. The references may + alias in this case. + 2. The base access types don't have the same alias set, i.e. one set + is a subset of the other. We have proved that B1 is not in the + access path B2.path and that B2 is not in the access path B1.path + so the references may not alias. */ + return get_alias_set (type1) == get_alias_set (type2); } /* Return true if two memory references based on the variables BASE1 @@ -681,10 +691,10 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, if (ref1 && ref2 && handled_component_p (ref1) && handled_component_p (ref2)) - return nonaliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), - offset1, max_size1, - ref2, TREE_TYPE (base2), - offset2, max_size2); + return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), + offset1, max_size1, + ref2, TREE_TYPE (base2), + offset2, max_size2); return true; } @@ -742,10 +752,10 @@ indirect_refs_may_alias_p (tree ref1, tree ptr1, if (ref1 && ref2 && handled_component_p (ref1) && handled_component_p (ref2)) - return nonaliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), - offset1, max_size1, - ref2, TREE_TYPE (TREE_TYPE (ptr2)), - offset2, max_size2); + return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), + offset1, max_size1, + ref2, TREE_TYPE (TREE_TYPE (ptr2)), + offset2, max_size2); return true; } -- cgit v1.2.1 From 7814d4186a9b0b10e6e62133d5210cb2589de1de Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 26 Oct 2009 13:00:36 +0000 Subject: PR tree-optimization/41783 * tree-ssa-alias.c (get_continuation_for_phi): Export, add a special case for simple diamonds * tree-ssa-alias.h (get_continuation_for_phi): Declare. * tree-ssa-pre.c (translate_vuse_through_block): Add same_valid argument, use alias oracle to skip some vdefs. (phi_translate_1): Change call to above, don't allocate new value ids if they can stay the same. (compute_avail): Allow vuse walking when looking up references. testsuite/ * gcc.dg/pr41783.c: New test. * gcc.dg/tree-ssa/ssa-pre-23.c: Adjust. * gcc.dg/tree-ssa/ssa-pre-24.c: Don't xfail anymore. * gcc.dg/tree-ssa/ssa-pre-27.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153551 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index ba5cbbc9488..fbd047085da 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1313,8 +1313,6 @@ stmt_may_clobber_ref_p (gimple stmt, tree ref) } -static tree get_continuation_for_phi (gimple, ao_ref *, bitmap *); - /* Walk the virtual use-def chain of VUSE until hitting the virtual operand TARGET or a statement clobbering the memory reference REF in which case false is returned. The walk starts with VUSE, one argument of PHI. */ @@ -1358,7 +1356,7 @@ maybe_skip_until (gimple phi, tree target, ao_ref *ref, clobber REF. Returns NULL_TREE if no suitable virtual operand can be found. */ -static tree +tree get_continuation_for_phi (gimple phi, ao_ref *ref, bitmap *visited) { unsigned nargs = gimple_phi_num_args (phi); @@ -1375,6 +1373,7 @@ get_continuation_for_phi (gimple phi, ao_ref *ref, bitmap *visited) tree arg1 = PHI_ARG_DEF (phi, 1); gimple def0 = SSA_NAME_DEF_STMT (arg0); gimple def1 = SSA_NAME_DEF_STMT (arg1); + tree common_vuse; if (arg0 == arg1) return arg0; @@ -1393,6 +1392,26 @@ get_continuation_for_phi (gimple phi, ao_ref *ref, bitmap *visited) if (maybe_skip_until (phi, arg1, ref, arg0, visited)) return arg1; } + /* Special case of a diamond: + MEM_1 = ... + goto (cond) ? L1 : L2 + L1: store1 = ... #MEM_2 = vuse(MEM_1) + goto L3 + L2: store2 = ... #MEM_3 = vuse(MEM_1) + L3: MEM_4 = PHI + We were called with the PHI at L3, MEM_2 and MEM_3 don't + dominate each other, but still we can easily skip this PHI node + if we recognize that the vuse MEM operand is the same for both, + and that we can skip both statements (they don't clobber us). + This is still linear. Don't use maybe_skip_until, that might + potentially be slow. */ + else if ((common_vuse = gimple_vuse (def0)) + && common_vuse == gimple_vuse (def1)) + { + if (!stmt_may_clobber_ref_p_1 (def0, ref) + && !stmt_may_clobber_ref_p_1 (def1, ref)) + return common_vuse; + } } return NULL_TREE; -- cgit v1.2.1 From 119147d12d323bafa652a1dff5962c9a1b800bd7 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 28 Oct 2009 13:28:32 +0000 Subject: 2009-10-28 Richard Guenther PR middle-end/41855 * tree-ssa-alias.c (refs_may_alias_p_1): Deal with CONST_DECLs (ref_maybe_used_by_call_p_1): Fix bcopy handling. (call_may_clobber_ref_p_1): Likewise. * tree-ssa-structalias.c (find_func_aliases): Likewise. * alias.c (nonoverlapping_memrefs_p): Deal with CONST_DECLs. * gfortran.dg/lto/20091028-1_0.f90: New testcase. * gfortran.dg/lto/20091028-1_1.c: Likewise. * gfortran.dg/lto/20091028-2_0.f90: Likewise. * gfortran.dg/lto/20091028-2_1.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153655 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index fbd047085da..4c052be418f 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -776,12 +776,14 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) || SSA_VAR_P (ref1->ref) || handled_component_p (ref1->ref) || INDIRECT_REF_P (ref1->ref) - || TREE_CODE (ref1->ref) == TARGET_MEM_REF) + || TREE_CODE (ref1->ref) == TARGET_MEM_REF + || TREE_CODE (ref1->ref) == CONST_DECL) && (!ref2->ref || SSA_VAR_P (ref2->ref) || handled_component_p (ref2->ref) || INDIRECT_REF_P (ref2->ref) - || TREE_CODE (ref2->ref) == TARGET_MEM_REF)); + || TREE_CODE (ref2->ref) == TARGET_MEM_REF + || TREE_CODE (ref2->ref) == CONST_DECL)); /* Decompose the references into their base objects and the access. */ base1 = ao_ref_base (ref1); @@ -798,6 +800,8 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) which is seen as a struct copy. */ if (TREE_CODE (base1) == SSA_NAME || TREE_CODE (base2) == SSA_NAME + || TREE_CODE (base1) == CONST_DECL + || TREE_CODE (base2) == CONST_DECL || is_gimple_min_invariant (base1) || is_gimple_min_invariant (base2)) return false; @@ -934,7 +938,6 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) their first argument. */ case BUILT_IN_STRCPY: case BUILT_IN_STRNCPY: - case BUILT_IN_BCOPY: case BUILT_IN_MEMCPY: case BUILT_IN_MEMMOVE: case BUILT_IN_MEMPCPY: @@ -952,6 +955,15 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) size); return refs_may_alias_p_1 (&dref, ref, false); } + case BUILT_IN_BCOPY: + { + ao_ref dref; + tree size = gimple_call_arg (call, 2); + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 0), + size); + return refs_may_alias_p_1 (&dref, ref, false); + } /* The following builtins do not read from memory. */ case BUILT_IN_FREE: case BUILT_IN_MEMSET: @@ -1151,7 +1163,6 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) their first argument. */ case BUILT_IN_STRCPY: case BUILT_IN_STRNCPY: - case BUILT_IN_BCOPY: case BUILT_IN_MEMCPY: case BUILT_IN_MEMMOVE: case BUILT_IN_MEMPCPY: @@ -1170,6 +1181,15 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) size); return refs_may_alias_p_1 (&dref, ref, false); } + case BUILT_IN_BCOPY: + { + ao_ref dref; + tree size = gimple_call_arg (call, 2); + ao_ref_init_from_ptr_and_size (&dref, + gimple_call_arg (call, 1), + size); + return refs_may_alias_p_1 (&dref, ref, false); + } /* Freeing memory kills the pointed-to memory. More importantly the call has to serve as a barrier for moving loads and stores across it. */ -- cgit v1.2.1 From 48e1416a24d50cacbb2a5e06a9ee61dd8cbee313 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 25 Nov 2009 10:55:54 +0000 Subject: Remove trailing white spaces. 2009-11-25 H.J. Lu * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154645 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 4c052be418f..6ba550bbff0 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -325,7 +325,7 @@ dump_alias_info (FILE *file) fprintf (file, "\n\nAlias information for %s\n\n", funcname); fprintf (file, "Aliased symbols\n\n"); - + FOR_EACH_REFERENCED_VAR (var, rvi) { if (may_be_aliased (var)) @@ -345,7 +345,7 @@ dump_alias_info (FILE *file) { tree ptr = ssa_name (i); struct ptr_info_def *pi; - + if (ptr == NULL_TREE || SSA_NAME_IN_FREE_LIST (ptr)) continue; -- cgit v1.2.1 From f018d957a72d418d69c6d2d8bc80c9415666a9f6 Mon Sep 17 00:00:00 2001 From: jakub Date: Sat, 28 Nov 2009 16:21:00 +0000 Subject: * matrix-reorg.c (analyze_matrix_allocation_site): Remove unused malloc_fname variable. (check_allocation_function): Remove unused gsi and bb_level_0 variables. (transform_access_sites): Remove unused d_type_size and d_type_size_k variables. * omega.c (resurrect_subs): Remove unused n variable. (omega_solve_geq): Remove unused neweqns variable. * lto-streamer-in.c (lto_read_tree): Remove unused end_marker variable. * tree-inline.c (declare_return_variable): Remove USE_P argument, return use instead of var. (remap_decl, remap_block): Remove unused fn variable. (expand_call_inline): Remove unused retvar variable, adjust declare_return_variable caller. (optimize_inline_calls): Remove unused prev_fn variable. * tree-vect-slp.c (vect_analyze_slp_instance): Remove unused ncopies variable. (vect_create_mask_and_perm): Remove unused group_size and dr_chain_size variables. * tree-ssa-loop-niter.c (split_to_var_and_offset): Handle MINUS_EXPR properly. * tree-vect-loop.c (vect_analyze_loop_form): Remove unused backedge variable. (vect_create_epilog_for_reduction): Remove unused bytesize variable. * omp-low.c (workshare_safe_to_combine_p): Remove par_entry_bb parameter. Remove unused par_stmt variable. (determine_parallel_type): Adjust workshare_safe_to_combine_p caller. (expand_omp_sections): Remove unused l1 variable. (lower_omp_for): Remove unused ilist variable. * tree-loop-distribution.c (mark_nodes_having_upstream_mem_writes): Remove unused has_upstream_mem_write_p variable. * recog.c (decode_asm_operands): Remove unused noperands variable. * tree-ssa-alias.c (refs_may_alias_p_1): Remove unused size1 and size2 variable. * libgcov.c (__gcov_merge_delta): Remove unused last variable. * tree-call-cdce.c (gen_conditions_for_pow_int_base): Remove unused base_nm variable. (gen_conditions_for_pow): Remove unused ec variable. * tree-ssa-sccvn.c (vn_reference_lookup_3): Remove unused size variable. * ipa-struct-reorg.c (program_redefines_malloc_p): Remove unused fndecl variable. * tree-ssa-sink.c (statement_sink_location): Remove unused code variable. * regmove.c (copy_src_to_dest): Remove unused insn_uid and move_uid variables. * tree-complex.c (create_one_component_var): Remove unused inner_type variable. * calls.c (emit_call_1): Don't GEN_INT (struct_value_size) unnecessarily when GEN_*CALL omits that argument. * regrename.c (regrename_optimize): Remove unused regs_seen variable. (build_def_use): Remove unused icode variable. * ipa-pure-const.c (check_call): Remove unused callee and avail variables. * tree-dfa.c (add_referenced_var): Remove unused v_ann variable. * tree-vect-patterns.c (vect_recog_pow_pattern): Remove unused type variable. (vect_pattern_recog): Remove unused stmt variable. * sel-sched-ir.c (make_regions_from_the_rest): Remove unused new_regions variable. * postreload.c (reload_cse_simplify_operands): Remove unused mode variable. * tree-parloops.c (create_call_for_reduction_1): Remove unused addr_type variable. (create_parallel_loop): Remove unused res variable. (gen_parallel_loop): Remove unused nloop variable. * tree-vect-loop-manip.c (vect_loop_versioning): Likewise. * value-prof.c (gimple_mod_subtract_transform, gimple_stringops_transform): Remove unused value variable. (gimple_stringops_values_to_profile): Remove unused fcode variable. * tree-vrp.c (register_new_assert_for): Remove unused found variable. (vrp_visit_switch_stmt): Remove unused n variable. * tree-vect-stmts.c (vectorizable_conversion): Remove unused expr variable. (vectorizable_operation): Remove unused shift_p variable. (vectorizable_store): Remove unused first_stmt_vinfo variable. * tree-ssa-operands.c (add_stmt_operand): Remove unused v_ann variable. * tree-vect-data-refs.c (vect_analyze_data_refs): Remove unused bb variable. (vect_permute_store_chain): Remove unused scalar_dest variable. (vect_supportable_dr_alignment): Remove unused invariant_in_outerloop variable. * tree-ssa-threadupdate.c (thread_single_edge): Remove unused local_info variable. * tree-optimize.c (tree_rest_of_compilation): Remove unused node variable. * optabs.c (expand_binop): Remove unused equiv_value variable. (emit_libcall_block): Remove unused prev variable. (init_optabs): Remove unused int_mode variable. * tree-ssa-structalias.c (scc_visit): Remove unused have_ref_node variable. (do_structure_copy): Remove unused lhsbase and rhsbase variables. (find_func_aliases): Remove unused rhstype variable. (ipa_pta_execute): Remove unused varid variable. gcc/objc/ * objc-act.c (generate_shared_structures): Remove unused sc_spec and decl_specs variables. (objc_build_message_expr): Remove unused loc variable. (objc_finish_message_expr): Remove unused saved_rtype variable. (encode_field_decl): Remove unused type variable. gcc/lto/ * lto-lang.c (handle_nonnull_attribute): Remove unused attr_arg_num variable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154726 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 6ba550bbff0..e7137087625 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -767,7 +767,6 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) { tree base1, base2; HOST_WIDE_INT offset1 = 0, offset2 = 0; - HOST_WIDE_INT size1 = -1, size2 = -1; HOST_WIDE_INT max_size1 = -1, max_size2 = -1; bool var1_p, var2_p, ind1_p, ind2_p; alias_set_type set; @@ -788,11 +787,9 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) /* Decompose the references into their base objects and the access. */ base1 = ao_ref_base (ref1); offset1 = ref1->offset; - size1 = ref1->size; max_size1 = ref1->max_size; base2 = ao_ref_base (ref2); offset2 = ref2->offset; - size2 = ref2->size; max_size2 = ref2->max_size; /* We can end up with registers or constants as bases for example from -- cgit v1.2.1 From 0d3ca08e1e03c5b1259f47dac776d8fb6b1a66bb Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 4 Dec 2009 14:42:23 +0000 Subject: 2009-12-04 Richard Guenther * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle BUILT_IN_MALLOC. (call_may_clobber_ref_p_1): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154979 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e7137087625..cbb43b5bfea 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -963,6 +963,7 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) } /* The following builtins do not read from memory. */ case BUILT_IN_FREE: + case BUILT_IN_MALLOC: case BUILT_IN_MEMSET: case BUILT_IN_FREXP: case BUILT_IN_FREXPF: @@ -1187,6 +1188,10 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) size); return refs_may_alias_p_1 (&dref, ref, false); } + /* Allocating memory does not have any side-effects apart from + being the definition point for the pointer. */ + case BUILT_IN_MALLOC: + return false; /* Freeing memory kills the pointed-to memory. More importantly the call has to serve as a barrier for moving loads and stores across it. */ -- cgit v1.2.1 From 4b4d1513df0d72611a831542d4d5fc3a2dc51052 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Fri, 29 Jan 2010 18:21:39 +0000 Subject: * tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have the same alias set and their sizes different constantness. (aliasing_component_refs_p): Revert 2009-10-24 change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156362 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index cbb43b5bfea..6ace7e32680 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -537,13 +537,22 @@ same_type_for_tbaa (tree type1, tree type2) if (TYPE_CANONICAL (type1) == TYPE_CANONICAL (type2)) return 1; - /* ??? Array types are not properly unified in all cases as we have + /* ??? Array types are not properly unified in all cases as we have spurious changes in the index types for example. Removing this causes all sorts of problems with the Fortran frontend. */ if (TREE_CODE (type1) == ARRAY_TYPE && TREE_CODE (type2) == ARRAY_TYPE) return -1; + /* In Ada, an lvalue of unconstrained type can be used to access an object + of one of its constrained subtypes, for example when a function with an + unconstrained parameter passed by reference is called on a constrained + object and inlined. In this case, the types have the same alias set. */ + if (TYPE_SIZE (type1) && TYPE_SIZE (type2) + && TREE_CONSTANT (TYPE_SIZE (type1)) != TREE_CONSTANT (TYPE_SIZE (type2)) + && get_alias_set (type1) == get_alias_set (type2)) + return -1; + /* The types are known to be not equal. */ return 0; } @@ -600,19 +609,9 @@ aliasing_component_refs_p (tree ref1, tree type1, offset1 -= offadj; return ranges_overlap_p (offset1, max_size1, offset2, max_size2); } - - /* We haven't found any common base to apply offset-based disambiguation. - There are two cases: - 1. The base access types have the same alias set. This can happen - in Ada when a function with an unconstrained parameter passed by - reference is called on a constrained object and inlined: the types - have the same alias set but aren't equivalent. The references may - alias in this case. - 2. The base access types don't have the same alias set, i.e. one set - is a subset of the other. We have proved that B1 is not in the - access path B2.path and that B2 is not in the access path B1.path - so the references may not alias. */ - return get_alias_set (type1) == get_alias_set (type2); + /* If we have two type access paths B1.path1 and B2.path2 they may + only alias if either B1 is in B2.path2 or B2 is in B1.path1. */ + return false; } /* Return true if two memory references based on the variables BASE1 -- cgit v1.2.1 From 4ef43bbdd80b43a9843092db88a86bb5d4e9cc19 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 3 Feb 2010 13:03:39 +0000 Subject: 2010-02-03 Richard Guenther PR tree-optimization/42944 * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Handle calloc. (call_may_clobber_ref_p_1): Likewise. Properly handle malloc and calloc clobbering errno. * gcc.dg/errno-1.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156467 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 6ace7e32680..16abb4c5222 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -963,6 +963,7 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) /* The following builtins do not read from memory. */ case BUILT_IN_FREE: case BUILT_IN_MALLOC: + case BUILT_IN_CALLOC: case BUILT_IN_MEMSET: case BUILT_IN_FREXP: case BUILT_IN_FREXPF: @@ -1190,6 +1191,21 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) /* Allocating memory does not have any side-effects apart from being the definition point for the pointer. */ case BUILT_IN_MALLOC: + case BUILT_IN_CALLOC: + /* Unix98 specifies that errno is set on allocation failure. + Until we properly can track the errno location assume it + is not a plain decl but anonymous storage in a different + translation unit. */ + if (flag_errno_math) + { + struct ptr_info_def *pi; + if (DECL_P (base)) + return false; + if (INDIRECT_REF_P (base) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME + && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)))) + return pi->pt.anything || pi->pt.nonlocal; + } return false; /* Freeing memory kills the pointed-to memory. More importantly the call has to serve as a barrier for moving loads and stores -- cgit v1.2.1 From 67817f0fb1a998e7fc4acd8229e128b4d0e5dc89 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 11 Feb 2010 15:38:59 +0000 Subject: 2010-02-11 Richard Guenther PR lto/41664 * tree-ssa-alias.c (refs_may_alias_p_1): Canonicalize pointer-vs-decl case by swapping refs. Handle some cases of pointer-vs-decl disambiguations more conservatively. * cfgexpand.c (gimple_expand_cfg): Set gimple_df->in_ssa_p to false after expanding. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156699 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 71 insertions(+), 7 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 16abb4c5222..7b602012799 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -818,6 +818,77 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) return decl_refs_may_alias_p (base1, offset1, max_size1, base2, offset2, max_size2); + ind1_p = INDIRECT_REF_P (base1); + ind2_p = INDIRECT_REF_P (base2); + /* Canonicalize the pointer-vs-decl case. */ + if (ind1_p && var2_p) + { + HOST_WIDE_INT tmp1; + tree tmp2; + ao_ref *tmp3; + tmp1 = offset1; offset1 = offset2; offset2 = tmp1; + tmp1 = max_size1; max_size1 = max_size2; max_size2 = tmp1; + tmp2 = base1; base1 = base2; base2 = tmp2; + tmp3 = ref1; ref1 = ref2; ref2 = tmp3; + var1_p = true; + ind1_p = false; + var2_p = false; + ind2_p = true; + } + + /* If we are about to disambiguate pointer-vs-decl try harder to + see must-aliases and give leeway to some invalid cases. + This covers a pretty minimal set of cases only and does not + when called from the RTL oracle. It handles cases like + + int i = 1; + return *(float *)&i; + + and also fixes gfortran.dg/lto/pr40725. */ + if (var1_p && ind2_p + && cfun + && gimple_in_ssa_p (cfun) + && TREE_CODE (TREE_OPERAND (base2, 0)) == SSA_NAME) + { + gimple def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (base2, 0)); + while (is_gimple_assign (def_stmt) + && (gimple_assign_rhs_code (def_stmt) == SSA_NAME + || CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))) + { + tree rhs = gimple_assign_rhs1 (def_stmt); + HOST_WIDE_INT offset, size, max_size; + + /* Look through SSA name copies and pointer conversions. */ + if (TREE_CODE (rhs) == SSA_NAME + && POINTER_TYPE_P (TREE_TYPE (rhs))) + { + def_stmt = SSA_NAME_DEF_STMT (rhs); + continue; + } + if (TREE_CODE (rhs) != ADDR_EXPR) + break; + + /* If the pointer is defined as an address based on a decl + use plain offset disambiguation and ignore TBAA. */ + rhs = TREE_OPERAND (rhs, 0); + rhs = get_ref_base_and_extent (rhs, &offset, &size, &max_size); + if (SSA_VAR_P (rhs)) + { + base2 = rhs; + offset2 += offset; + if (size != max_size + || max_size == -1) + max_size2 = -1; + return decl_refs_may_alias_p (base1, offset1, max_size1, + base2, offset2, max_size2); + } + + /* Do not continue looking through &p->x to limit time + complexity. */ + break; + } + } + /* First defer to TBAA if possible. */ if (tbaa_p && flag_strict_aliasing @@ -833,19 +904,12 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) return true; /* Dispatch to the pointer-vs-decl or pointer-vs-pointer disambiguators. */ - ind1_p = INDIRECT_REF_P (base1); - ind2_p = INDIRECT_REF_P (base2); set = tbaa_p ? -1 : 0; if (var1_p && ind2_p) return indirect_ref_may_alias_decl_p (ref2->ref, TREE_OPERAND (base2, 0), offset2, max_size2, set, ref1->ref, base1, offset1, max_size1, set); - else if (ind1_p && var2_p) - return indirect_ref_may_alias_decl_p (ref1->ref, TREE_OPERAND (base1, 0), - offset1, max_size1, set, - ref2->ref, base2, - offset2, max_size2, set); else if (ind1_p && ind2_p) return indirect_refs_may_alias_p (ref1->ref, TREE_OPERAND (base1, 0), offset1, max_size1, set, -- cgit v1.2.1 From a29c5f9c8c897985652340bb0f741c54d7dd2ab6 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 19 Feb 2010 10:40:17 +0000 Subject: 2010-02-19 Richard Guenther PR tree-optimization/42944 * tree-ssa-alias.c (call_may_clobber_ref_p_1): Massage test for aliasing with errno. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156890 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 7b602012799..b235eccf08e 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1258,16 +1258,19 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) case BUILT_IN_CALLOC: /* Unix98 specifies that errno is set on allocation failure. Until we properly can track the errno location assume it - is not a plain decl but anonymous storage in a different - translation unit. */ - if (flag_errno_math) + is not a local decl but external or anonymous storage in + a different translation unit. Also assume it is of + type int as required by the standard. */ + if (flag_errno_math + && TREE_TYPE (base) == integer_type_node) { struct ptr_info_def *pi; - if (DECL_P (base)) - return false; - if (INDIRECT_REF_P (base) - && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME - && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)))) + if (DECL_P (base) + && !TREE_STATIC (base)) + return true; + else if (INDIRECT_REF_P (base) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME + && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)))) return pi->pt.anything || pi->pt.nonlocal; } return false; -- cgit v1.2.1 From 102bfc9cd640ebdddac9d3edf23cdbf3990a62c6 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Fri, 26 Feb 2010 23:10:24 +0000 Subject: PR ada/43096 * tree-ssa-alias.c (same_type_for_tbaa): Return -1 if the types have the same alias set. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157102 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index b235eccf08e..73a16375613 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -544,13 +544,15 @@ same_type_for_tbaa (tree type1, tree type2) && TREE_CODE (type2) == ARRAY_TYPE) return -1; - /* In Ada, an lvalue of unconstrained type can be used to access an object - of one of its constrained subtypes, for example when a function with an - unconstrained parameter passed by reference is called on a constrained - object and inlined. In this case, the types have the same alias set. */ - if (TYPE_SIZE (type1) && TYPE_SIZE (type2) - && TREE_CONSTANT (TYPE_SIZE (type1)) != TREE_CONSTANT (TYPE_SIZE (type2)) - && get_alias_set (type1) == get_alias_set (type2)) + /* ??? In Ada, an lvalue of an unconstrained type can be used to access an + object of one of its constrained subtypes, e.g. when a function with an + unconstrained parameter passed by reference is called on an object and + inlined. But, even in the case of a fixed size, type and subtypes are + not equivalent enough as to share the same TYPE_CANONICAL, since this + would mean that conversions between them are useless, whereas they are + not (e.g. type and subtypes can have different modes). So, in the end, + they are only guaranteed to have the same alias set. */ + if (get_alias_set (type1) == get_alias_set (type2)) return -1; /* The types are known to be not equal. */ -- cgit v1.2.1 From 7cf0dbf3e5eee1286c76c26a836622c9c9974736 Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 2 Apr 2010 19:54:46 +0000 Subject: * ada/gcc-interface/Make-lang.in, alias.c, attribs.c, auto-inc-dec.c, basic-block.h, bb-reorder.c, calls.c, c-common.c, cgraph.h, collect2.h, config/alpha/alpha.c, config/alpha/alpha.md, config/alpha/predicates.md, config/arm/arm.md, config/arm/lib1funcs.asm, config/arm/neon-schedgen.ml, config/avr/avr.c, config/avr/avr.md, config/bfin/bfin.c, config/darwin9.h, config/darwin.c, config/darwin.h, config/h8300/h8300.c, config/i386/cpuid.h, config/i386/cygming.h, config/i386/cygwin.h, config/i386/mingw32.h, config/i386/msformat-c.c, config/i386/sol2-10.h, config/i386/xopintrin.h, config/ia64/ia64.c, config/ia64/ia64.md, config/ia64/sync.md, config/mep/mep.c, config/mips/mips.md, config/mn10300/mn10300.c, config/mn10300/mn10300.h, config/pa/pa.c, config/pa/pa.md, config/rs6000/aix.h, config/rs6000/dfp.md, config/rs6000/rs6000-builtin.def, config/rs6000/rs6000-c.c, config/rs6000/vector.md, config/rtems.h, config/rx/rx.md, config/s390/s390.md, config/sol2-c.c, config/sparc/sol2-bi.h, config/sparc/sol2-gas.h, config/sparc/sparc.h, config/sparc/sparc.md, config/sparc/sparc-protos.h, config/spu/spu.c, config/spu/spu-c.c, config/t-darwin, convert.c, c.opt, c-opts.c, cp/Make-lang.in, c-pretty-print.c, c-typeck.c, df-core.c, df-scan.c, diagnostic.c, diagnostic.h, doc/cppopts.texi, doc/cpp.texi, doc/extend.texi, doc/gimple.texi, doc/languages.texi, doc/plugins.texi, doc/rtl.texi, doc/standards.texi, doc/tree-ssa.texi, doc/trouble.texi, dominance.c, fold-const.c, fortran/Make-lang.in, fwprop.c, gcc-plugin.h, gensupport.c, gimple.h, gimple-iterator.c, graphite.c, graphite-clast-to-gimple.c, graphite-clast-to-gimple.h, graphite-dependences.c, graphite-poly.c, graphite-poly.h, graphite-ppl.c, graphite-ppl.h, graphite-scop-detection.c, graphite-sese-to-poly.c, graphite-sese-to-poly.h, ifcvt.c, intl.c, intl.h, ipa.c, ipa-cp.c, ipa-inline.c, ipa-prop.c, ipa-prop.h, ipa-pure-const.c, ipa-reference.c, ipa-type-escape.c, ira-color.c, ira-conflicts.c, ira-lives.c, java/Make-lang.in, lambda-code.c, loop-invariant.c, lto/Make-lang.in, lto-streamer.h, lto-streamer-in.c, objc/Make-lang.in, objcp/Make-lang.in, omp-low.c, optc-gen.awk, opt-functions.awk, opth-gen.awk, params.def, passes.c, postreload-gcse.c, print-tree.c, recog.c, regrename.c, reload.h, rtl.def, sched-int.h, sched-rgn.c, sel-sched-dump.c, sese.c, sese.h, store-motion.c, stor-layout.c, tree-cfgcleanup.c, tree-chrec.c, tree-complex.c, tree-data-ref.c, tree.def, tree-eh.c, tree-flow.h, tree-flow-inline.h, tree.h, tree-loop-distribution.c, tree-outof-ssa.c, tree-parloops.c, tree-pass.h, tree-predcom.c, tree-profile.c, tree-scalar-evolution.c, tree-ssa-address.c, tree-ssa-alias.c, tree-ssa-coalesce.c, tree-ssa-copy.c, tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-dse.c, tree-ssa-loop-im.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop-manip.c, tree-ssa-math-opts.c, tree-ssa-operands.c, tree-ssa-pre.c, tree-ssa-sccvn.c, tree-ssa-structalias.c, tree-ssa-uncprop.c, tree-tailcall.c, tree-vect-data-refs.c, tree-vect-loop.c, tree-vectorizer.h, tree-vect-slp.c, tree-vrp.c, unwind-dw2-fde-darwin.c, varpool.c: Update copyright years. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157950 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 73a16375613..47d611c9cac 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1,5 +1,5 @@ /* Alias analysis for trees. - Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Diego Novillo -- cgit v1.2.1 From 7f2d9047e1adab1993bd392999885c4023a176c7 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 7 Apr 2010 15:31:37 +0000 Subject: 2010-04-07 Richard Guenther * ipa-reference.c (mark_load): Use get_base_address. (mark_store): Likewise. * tree-ssa-ccp.c (gimplify_and_update_call_from_tree): Avoid inserting GIMPLE_NOPs into the IL. * tree-ssa-structalias.c (get_constraint_for_component_ref): Explicitly strip handled components and indirect references. * fold-const.c (fold_unary_loc): Do not strip qualifiers when folding address expressions. * gimple.c (gimple_ior_addresses_taken_1): Use get_base_address. * tree-ssa-alias.c (decl_refs_may_alias_p): Do not use operand_equal_p to compare decls. (ptr_deref_may_alias_decl_p): Likewise. * tree-ssa-operands.c (get_asm_expr_operands): Simplify * tree-ssa-forwprop.c (forward_propagate_into_gimple_cond): Handle reversed comparison ops. * tree-sra.c (asm_visit_addr): Use get_base_address. * ipa-prop.c (visit_store_addr_for_mod_analysis): Use get_base_address. * ipa-reference.c (mark_address): Use get_base_address. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158069 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 47d611c9cac..282148ce5e9 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -189,7 +189,7 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) ptr = TREE_OPERAND (base, 0); else if (base && SSA_VAR_P (base)) - return operand_equal_p (base, decl, 0); + return base == decl; else if (base && CONSTANT_CLASS_P (base)) return false; @@ -629,7 +629,7 @@ decl_refs_may_alias_p (tree base1, gcc_assert (SSA_VAR_P (base1) && SSA_VAR_P (base2)); /* If both references are based on different variables, they cannot alias. */ - if (!operand_equal_p (base1, base2, 0)) + if (base1 != base2) return false; /* If both references are based on the same variable, they cannot alias if -- cgit v1.2.1 From cb24521686308314fadcd96cdfd23858aa19aa95 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 12 Apr 2010 15:20:48 +0000 Subject: 2010-04-12 Richard Guenther * gsstruct.def (GSS_CALL): New. * gimple.def (GIMPLE_CALL): Change to GSS_CALL. * gimple.h: Include tree-ssa-alias.h. (struct gimple_statement_call): New. (union gimple_statement_struct_d): Add gimple_call member. (gimple_call_reset_alias_info): Declare. (gimple_call_use_set): New function. (gimple_call_clobber_set): Likewise. * Makefile.in (GIMPLE_H): Add tree-ssa-alias.h. * gimple.c (gimple_call_reset_alias_info): New function. (gimple_build_call_1): Call it. * lto-streamer-in.c (input_gimple_stmt): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. (expand_call_inline): Remove callused handling. * cfgexpand.c (update_alias_info_with_stack_vars): Likewise. * tree-dfa.c (dump_variable): Likewise. * tree-parloops.c (parallelize_loops): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. (delete_tree_ssa): Likewise. * tree-flow-inline.h (is_call_used): Remove. * tree-flow.h (struct gimple_df): Remove callused member. * tree-nrv.c (dest_safe_for_nrv_p): Adjust predicate. * tree-ssa-alias.c (dump_alias_info): Remove callused handling. (ref_maybe_used_by_call_p_1): Simplify. (call_may_clobber_ref_p_1): Likewise. * tree-ssa-structalias.c (compute_points_to_sets): Set the call stmt used and clobbered sets. * tree-tailcall.c (suitable_for_tail_opt_p): Adjust predicate. (find_tail_calls): Verify the tail call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158226 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 57 +++++++++++++--------------------------------------- 1 file changed, 14 insertions(+), 43 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 282148ce5e9..7f09df8d16c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -336,8 +336,6 @@ dump_alias_info (FILE *file) fprintf (file, "\nESCAPED"); dump_points_to_solution (file, &cfun->gimple_df->escaped); - fprintf (file, "\nCALLUSED"); - dump_points_to_solution (file, &cfun->gimple_df->callused); fprintf (file, "\n\nFlow-insensitive points-to information\n\n"); @@ -1070,51 +1068,24 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) goto process_args; } - /* If the base variable is call-used or call-clobbered then - it may be used. */ - if (flags & (ECF_PURE|ECF_CONST|ECF_LOOPING_CONST_OR_PURE|ECF_NOVOPS)) + /* Check if the base variable is call-used. */ + if (DECL_P (base)) { - if (DECL_P (base)) - { - if (is_call_used (base)) - return true; - } - else if (INDIRECT_REF_P (base) - && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) - { - struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); - if (!pi) - return true; - - if (pt_solution_includes_global (&pi->pt) - || pt_solutions_intersect (&cfun->gimple_df->callused, &pi->pt) - || pt_solutions_intersect (&cfun->gimple_df->escaped, &pi->pt)) - return true; - } - else + if (pt_solution_includes (gimple_call_use_set (call), base)) return true; } - else + else if (INDIRECT_REF_P (base) + && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) { - if (DECL_P (base)) - { - if (is_call_clobbered (base)) - return true; - } - else if (INDIRECT_REF_P (base) - && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) - { - struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); - if (!pi) - return true; + struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); + if (!pi) + return true; - if (pt_solution_includes_global (&pi->pt) - || pt_solutions_intersect (&cfun->gimple_df->escaped, &pi->pt)) - return true; - } - else + if (pt_solutions_intersect (gimple_call_use_set (call), &pi->pt)) return true; } + else + return true; /* Inspect call arguments for passed-by-value aliases. */ process_args: @@ -1347,8 +1318,9 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) return false; } + /* Check if the base variable is call-clobbered. */ if (DECL_P (base)) - return is_call_clobbered (base); + return pt_solution_includes (gimple_call_clobber_set (call), base); else if (INDIRECT_REF_P (base) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) { @@ -1356,8 +1328,7 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) if (!pi) return true; - return (pt_solution_includes_global (&pi->pt) - || pt_solutions_intersect (&cfun->gimple_df->escaped, &pi->pt)); + return pt_solutions_intersect (gimple_call_clobber_set (call), &pi->pt); } return true; -- cgit v1.2.1 From 1a981e1a975098bd537556d2b36f275f3bc075c7 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 15 Apr 2010 13:16:44 +0000 Subject: 2010-04-15 Richard Guenther * tree-ssa-structalias.c (struct variable_info): Add is_fn_info flag. (new_var_info): Initialize it. (dump_constraints): Support printing last added constraints. (debug_constraints): Adjust. (dump_constraint_graph): Likewise. (make_heapvar_for): Check for NULL cfun. (get_function_part_constraint): New function. (get_fi_for_callee): Likewise. (find_func_aliases): Properly implement IPA PTA constraints. (process_ipa_clobber): New function. (find_func_clobbers): Likewise. (insert_into_field_list_sorted): Remove. (create_function_info_for): Properly allocate vars for IPA mode. Do not use insert_into_field_list_sorted. (create_variable_info_for): Properly generate constraints for global vars in IPA mode. (dump_solution_for_var): Always dump the solution. (set_uids_in_ptset): Initialize DECL_PT_UID if in ipa-mode. (find_what_var_points_to): Adjust. (pt_solution_set): Change. (pt_solution_ior_into): New function. (pt_solution_empty_p): Export. (pt_solution_includes_global): Adjust. (pt_solution_includes_1): Likewise. (pt_solutions_intersect_1): Likewise. (dump_sa_points_to_info): Check some invariants. (solve_constraints): Move constraint dumping ... (compute_points_to_sets): ... here. (ipa_pta_execute): ... and here. (compute_may_aliases): Do not re-compute points-to info locally if IPA info is available. (ipa_escaped_pt): New global var. (ipa_pta_execute): Properly implement IPA PTA. * tree-into-ssa.c (dump_decl_set): Support dumping decls not in referenced-vars. * tree-flow.h (struct gimple_df): Add ipa_pta flag. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Adjust. (dump_points_to_solution): Likewise. * tree-dfa.c (dump_variable): Also dump DECL_PT_UID. * tree-inline.c (remap_ssa_name): Copy IPA points-to solution. (remap_gimple_stmt): Reset call clobber/use information if necessary. (copy_decl_to_var): Copy DECL_PT_UID. (copy_result_decl_to_var): Likewise. * tree.c (make_node_stat): Initialize DECL_PT_UID. (copy_node_stat): Copy it. * tree.h (DECL_PT_UID): New macro. (SET_DECL_PT_UID): Likewise. (DECL_PT_UID_SET_P): Likewise. (struct tree_decl_minimal): Add pt_uid member. * tree-ssa-alias.h (struct pt_solution): Add ipa_escaped flag. (pt_solution_empty_p): Declare. (pt_solution_set): Adjust. (ipa_escaped_pt): Declare. * cfgexpand.c (update_alias_info_with_stack_vars): Adjust. * gimple-pretty-print.c (pp_points_to_solution): New function. (dump_gimple_call): Dump call clobber/use information. * tree-dump.c (dump_option_value_in): Add TDF_ALIAS entry. * tree-pass.h (TDF_ALIAS): New dump option. * tree-pretty-print.c (dump_decl_name): Dump DECL_PT_UID if asked to. * doc/invoke.texi (-fipa-pta): Update documentation. * gcc.dg/ipa/ipa-pta-1.c: New testcase. * gcc.dg/ipa/ipa-pta-2.c: Likewise. * gcc.dg/ipa/ipa-pta-3.c: Likewise. * gcc.dg/ipa/ipa-pta-4.c: Likewise. * gcc.dg/ipa/ipa-pta-5.c: Likewise. * gcc.dg/ipa/ipa-pta-6.c: Likewise. * gcc.dg/ipa/ipa-pta-7.c: Likewise. * gcc.dg/ipa/ipa-pta-8.c: Likewise. * gcc.dg/ipa/ipa-pta-9.c: Likewise. * gcc.dg/ipa/ipa-pta-10.c: Likewise. * gcc.dg/ipa/ipa-pta-11.c: Likewise. * gcc.dg/ipa/ipa-pta-12.c: Likewise. * gcc.dg/ipa/ipa-pta-13.c: Likewise. * gcc.dg/torture/ipa-pta-2.c: Likewise. * gcc.dg/torture/ipa-pta-1.c: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158374 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 7f09df8d16c..8b1fdc37556 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -214,7 +214,7 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) if (DECL_RESTRICTED_P (decl) && TYPE_RESTRICT (TREE_TYPE (ptr)) && pi->pt.vars_contains_restrict) - return bitmap_bit_p (pi->pt.vars, DECL_UID (decl)); + return bitmap_bit_p (pi->pt.vars, DECL_PT_UID (decl)); return pt_solution_includes (&pi->pt, decl); } @@ -401,6 +401,9 @@ dump_points_to_solution (FILE *file, struct pt_solution *pt) if (pt->escaped) fprintf (file, ", points-to escaped"); + if (pt->ipa_escaped) + fprintf (file, ", points-to unit escaped"); + if (pt->null) fprintf (file, ", points-to NULL"); @@ -410,6 +413,8 @@ dump_points_to_solution (FILE *file, struct pt_solution *pt) dump_decl_set (file, pt->vars); if (pt->vars_contains_global) fprintf (file, " (includes global vars)"); + if (pt->vars_contains_restrict) + fprintf (file, " (includes restrict tags)"); } } -- cgit v1.2.1 From 4debfcfc2011ada93fe865e36272fd8b0fb83ba5 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 16 Apr 2010 13:21:38 +0000 Subject: 2010-04-16 Richard Guenther PR tree-optimization/43572 * tree-ssa-alias.h (call_may_clobber_ref_p): Declare. * tree-ssa-alias.c (call_may_clobber_ref_p): Export. * tree-flow.h (is_call_clobbered): Remove. * tree-flow-inline.h (is_call_clobbered): Likewise. * tree-dfa.c (dump_variable): Do not dump call clobber state. * tree-nrv.c (dest_safe_for_nrv_p): Use the alias oracle. (execute_return_slot_opt): Adjust. * tree-tailcall.c (suitable_for_tail_opt_p): Remove check for call clobbered vars here. (find_tail_calls): Move tailcall verification to the proper place. * gcc.dg/tree-ssa/tailcall-5.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158418 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 8b1fdc37556..67c669e8b4b 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1339,7 +1339,10 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) return true; } -static bool ATTRIBUTE_UNUSED +/* If the call in statement CALL may clobber the memory reference REF + return true, otherwise return false. */ + +bool call_may_clobber_ref_p (gimple call, tree ref) { bool res; -- cgit v1.2.1 From 8ce860079ffd104495b86756bd5c7729e69ff06f Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 10 May 2010 09:43:17 +0000 Subject: 2010-05-10 Richard Guenther * c-common.c (struct c_common_attributes): Add fnspec attribute. (handle_fnspec_attribute): New function. * gimple.h (gimple_call_return_flags): Declare. (gimple_call_arg_flags): Likewise. * gimple.c (gimple_call_arg_flags): New function. (gimple_call_return_flags): Likewise. * tree.h (EAF_DIRECT, EAF_NOCLOBBER, EAF_NOESCAPE, EAF_UNUSED): New argument flags. (ERF_RETURN_ARG_MASK, ERF_RETURNS_ARG, ERF_NOALIAS): New function return value flags. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1): Skip unused args. * tree-ssa-structalias.c (make_constraint_from_heapvar): Split main work to ... (make_heapvar_for): ... this new function. (handle_rhs_call): Handle fnspec attribute argument specifiers. (handle_lhs_call): Likewise. (find_func_aliases): Adjust. fortran/ * trans-decl.c (gfc_build_library_function_decl): Split out worker to ... (build_library_function_decl_1): ... this new function. Set a fnspec attribute if a specification was provided. (gfc_build_library_function_decl_with_spec): New function. (gfc_build_intrinsic_function_decls): Annotate internal_pack and internal_unpack. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159215 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 67c669e8b4b..715c2f10f9a 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1097,6 +1097,10 @@ process_args: for (i = 0; i < gimple_call_num_args (call); ++i) { tree op = gimple_call_arg (call, i); + int flags = gimple_call_arg_flags (call, i); + + if (flags & EAF_UNUSED) + continue; if (TREE_CODE (op) == WITH_SIZE_EXPR) op = TREE_OPERAND (op, 0); -- cgit v1.2.1 From d97be7136154237ee53af38b9486800e0474d8fb Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 15 May 2010 16:57:35 +0000 Subject: * ipa-reference.c: Include toplev.h (is_proper_for_analysis): Only add to all_module_statics if it is allocated. (write_node_summary_p, stream_out_bitmap, ipa_reference_write_optimization_summary, ipa_reference_read_optimization_summary): New. (struct ipa_opt_pass_d pass_ipa_reference): Add optimization summary streaming. * lto-cgraph.c (referenced_from_this_partition_p, reachable_from_this_partition_p): New functions. * tree-ssa-alias.c (ref_maybe_used_by_call_p_1, call_may_clobber_ref_p_1): Ask ipa-reference even for public vars. * opts.c (decode_options): Enable ipa_reference. * Makefile.in (ipa-reference.o): Add toplev.h dependency. * lto-streamer.h (referenced_from_this_partition_p, reachable_from_this_partition_p): Declare. * gcc.dg/lto/ipareference_1.c: New file. * gcc.dg/lto/ipareference_2.c: New file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159435 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 715c2f10f9a..ed9b7c59f01 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -1061,8 +1061,7 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) /* Check if base is a global static variable that is not read by the function. */ if (TREE_CODE (base) == VAR_DECL - && TREE_STATIC (base) - && !TREE_PUBLIC (base)) + && TREE_STATIC (base)) { bitmap not_read; @@ -1316,8 +1315,7 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) by the function. */ if (callee != NULL_TREE && TREE_CODE (base) == VAR_DECL - && TREE_STATIC (base) - && !TREE_PUBLIC (base)) + && TREE_STATIC (base)) { bitmap not_written; -- cgit v1.2.1 From a7a4626828090600459358ca745c4482cf9551a1 Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 21 May 2010 13:53:22 +0000 Subject: gcc/ChangeLog: * tree.h: Include real.h and fixed-value.h as basic datatypes. * dfp.c, convert.c, reload1.c, reginfo.c, tree-flow.h, tree-ssa-threadedge.c, tree-ssanames.c, tree-loop-linear.c, tree-into-ssa.c, tree-vect-generic.c, tree-ssa-structalias.c, tree-ssa-loop-im.c, tree-dump.c, tree-complex.c, tree-ssa-uninit.c, genrecog.c, tree-ssa-threadupdate.c, tree-ssa-loop-niter.c, tree-pretty-print.c, tree-loop-distribution.c, tree-ssa-loop-unswitch.c, c-lex.c, optabs.c, postreload-gcse.c, tree-ssa-loop-manip.c, postreload.c, tree-ssa-loop-ch.c, tree-tailcall.c, tree.c, reload.c, tree-scalar-evolution.c, rtlanal.c, tree-phinodes.c, builtins.c, final.c, genoutput.c, fold-const.c, tree-ssa-dse.c, genautomata.c, tree-ssa-uncprop.c, toplev.c, tree-chrec.c, genemit.c, c-cppbuiltin.c, tree-ssa-sccvn.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c, mode-switching.c, tree-call-cdce.c, cse.c, genpeep.c, tree-ssa-math-opts.c, tree-ssa-dom.c, tree-nrv.c, tree-ssa-propagate.c, tree-ssa-alias.c, tree-ssa-sink.c, jump.c, ifcvt.c, dwarf2out.c, expr.c, genattrtab.c, genconditions.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop.c, tree-parloops.c, recog.c, tree-ssa-address.c, lcm.c, tree-eh.c, gimple-pretty-print.c, c-pretty-print.c, print-rtl.c, gcse.c, tree-if-conv.c, tree-data-ref.c, tree-affine.c, gimplify.c, tree-ssa-phiopt.c, implicit-zee.c, expmed.c, tree-dfa.c, emit-rtl.c, store-motion.c, cselib.c, tree-cfgcleanup.c, simplify-rtx.c, tree-ssa-pre.c, genpreds.c, tree-mudflap.c, print-tree.c, tree-ssa-copy.c, tree-ssa-forwprop.c, tree-ssa-dce.c, varasm.c, tree-nested.c, tree-ssa.c, tree-ssa-loop-prefetch.c, rtl.c, tree-inline.c, integrate.c, tree-optimize.c, tree-ssa-phiprop.c, fixed-value.c, combine.c, tree-profile.c, c-common.c, sched-vis.c, tree-cfg.c, passes.c, tree-ssa-reassoc.c, config/alpha/alpha.c, config/frv/frv.c, config/s390/s390.c, config/m32c/m32c.c, config/spu/spu.c, config/sparc/sparc.c, config/mep/mep.c, config/m32r/m32r.c, config/rx/rx.c, config/i386/i386.c, config/sh/sh.c, config/pdp11/pdp11.c, config/avr/avr.c, config/crx/crx.c, config/xtensa/xtensa.c, config/stormy16/stormy16.c, config/fr30/fr30.c, config/lm32/lm32.c, config/moxie/moxie.c, config/m68hc11/m68hc11.c, config/cris/cris.c, config/iq2000/iq2000.c, config/mn10300/mn10300.c, config/ia64/ia64.c, config/m68k/m68k.c, config/rs6000/rs6000.c, config/picochip/picochip.c, config/darwin.c, config/arc/arc.c, config/mcore/mcore.c, config/score/score3.c, config/score/score7.c, config/score/score.c, config/arm/arm.c, config/pa/pa.c, config/mips/mips.c, config/vax/vax.c, config/h8300/h8300.c, config/v850/v850.c, config/mmix/mmix.c, config/bfin/bfin.c: Clean up redundant includes. * Makefile.in: Update accordingly. java/ChangeLog: * typeck.c, decl.c, jcf-parse.c, except.c, expr.c: cp/Changelog: * error.c, tree.c, typeck2.c, cxx-pretty-print.c, mangle.c: Clean up redundant includes. fortran/ChangeLog: * trans-const.c, trans-types.c, trans-intrinsic.c: Clean up redundant includes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159663 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index ed9b7c59f01..a68ec10ec64 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -24,9 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tm.h" #include "tree.h" -#include "rtl.h" #include "tm_p.h" -#include "hard-reg-set.h" #include "basic-block.h" #include "timevar.h" #include "expr.h" -- cgit v1.2.1 From ce084dfc1cd60d867d38dbed86a914d82fa908d1 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Fri, 21 May 2010 22:34:26 +0000 Subject: * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index a68ec10ec64..2db30587324 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "function.h" #include "diagnostic.h" +#include "tree-pretty-print.h" #include "tree-dump.h" #include "gimple.h" #include "tree-flow.h" -- cgit v1.2.1 From ac30e3b2019b79581b621999b138c56b063d1c68 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 26 May 2010 10:30:31 +0000 Subject: 2010-05-26 Richard Guenther PR rtl-optimization/44164 * tree-ssa-alias.c (aliasing_component_refs_p): Fix the no-common access-path disambiguation. (indirect_ref_may_alias_decl_p): Adjust. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. * gcc.c-torture/execute/pr44164.c: New testcase. * g++.dg/tree-ssa/pr13146.C: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159861 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 50 +++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 41 insertions(+), 9 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 2db30587324..10292f27a96 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -563,13 +563,21 @@ same_type_for_tbaa (tree type1, tree type2) /* Determine if the two component references REF1 and REF2 which are based on access types TYPE1 and TYPE2 and of which at least one is based - on an indirect reference may alias. */ + on an indirect reference may alias. REF2 is the only one that can + be a decl in which case REF2_IS_DECL is true. + REF1_ALIAS_SET, BASE1_ALIAS_SET, REF2_ALIAS_SET and BASE2_ALIAS_SET + are the respective alias sets. */ static bool aliasing_component_refs_p (tree ref1, tree type1, + alias_set_type ref1_alias_set, + alias_set_type base1_alias_set, HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, tree ref2, tree type2, - HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2) + alias_set_type ref2_alias_set, + alias_set_type base2_alias_set, + HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2, + bool ref2_is_decl) { /* If one reference is a component references through pointers try to find a common base and apply offset based disambiguation. This handles @@ -613,8 +621,20 @@ aliasing_component_refs_p (tree ref1, tree type1, offset1 -= offadj; return ranges_overlap_p (offset1, max_size1, offset2, max_size2); } + /* If we have two type access paths B1.path1 and B2.path2 they may - only alias if either B1 is in B2.path2 or B2 is in B1.path1. */ + only alias if either B1 is in B2.path2 or B2 is in B1.path1. + But we can still have a path that goes B1.path1...B2.path2 with + a part that we do not see. So we can only disambiguate now + if there is no B2 in the tail of path1 and no B1 on the + tail of path2. */ + if (base1_alias_set == ref2_alias_set + || alias_set_subset_of (base1_alias_set, ref2_alias_set)) + return true; + /* If this is ptr vs. decl then we know there is no ptr ... decl path. */ + if (!ref2_is_decl) + return (base2_alias_set == ref1_alias_set + || alias_set_subset_of (base2_alias_set, ref1_alias_set)); return false; } @@ -649,9 +669,11 @@ decl_refs_may_alias_p (tree base1, static bool indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, + alias_set_type ref1_alias_set, alias_set_type base1_alias_set, tree ref2, tree base2, HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2, + alias_set_type ref2_alias_set, alias_set_type base2_alias_set) { /* If only one reference is based on a variable, they cannot alias if @@ -695,9 +717,11 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, && handled_component_p (ref1) && handled_component_p (ref2)) return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), + ref1_alias_set, base1_alias_set, offset1, max_size1, ref2, TREE_TYPE (base2), - offset2, max_size2); + ref2_alias_set, base2_alias_set, + offset2, max_size2, true); return true; } @@ -712,9 +736,11 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, static bool indirect_refs_may_alias_p (tree ref1, tree ptr1, HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, + alias_set_type ref1_alias_set, alias_set_type base1_alias_set, tree ref2, tree ptr2, HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2, + alias_set_type ref2_alias_set, alias_set_type base2_alias_set) { /* If both bases are based on pointers they cannot alias if they may not @@ -756,9 +782,11 @@ indirect_refs_may_alias_p (tree ref1, tree ptr1, && handled_component_p (ref1) && handled_component_p (ref2)) return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), + ref1_alias_set, base1_alias_set, offset1, max_size1, ref2, TREE_TYPE (TREE_TYPE (ptr2)), - offset2, max_size2); + ref2_alias_set, base2_alias_set, + offset2, max_size2, false); return true; } @@ -911,14 +939,18 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) set = tbaa_p ? -1 : 0; if (var1_p && ind2_p) return indirect_ref_may_alias_decl_p (ref2->ref, TREE_OPERAND (base2, 0), - offset2, max_size2, set, + offset2, max_size2, + ao_ref_alias_set (ref2), set, ref1->ref, base1, - offset1, max_size1, set); + offset1, max_size1, + ao_ref_alias_set (ref1), set); else if (ind1_p && ind2_p) return indirect_refs_may_alias_p (ref1->ref, TREE_OPERAND (base1, 0), - offset1, max_size1, set, + offset1, max_size1, + ao_ref_alias_set (ref1), set, ref2->ref, TREE_OPERAND (base2, 0), - offset2, max_size2, set); + offset2, max_size2, + ao_ref_alias_set (ref2), set); gcc_unreachable (); } -- cgit v1.2.1 From 4b987facd8ba658d00c277a7e9c46548b492854f Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 29 May 2010 20:31:45 +0000 Subject: * tree-vrp.c (debug_value_range, debug_all_value_ranges, debug_asserts_for, debug_all_asserts): Annotate with DEBUG_FUNCTION. * tree-into-ssa.c (debug_decl_set, debug_defs_stack, debug_currdefs, debug_tree_ssa, debug_tree_ssa_stats, debug_def_blocks, debug_names_replaced_by, debug_update_ssa): Likewise. * sbitmap.c (debug_sbitmap): Likewise. * genrecog.c (debug_decision, debug_decision_list): Likewise. * tree-pretty-print.c (debug_generic_expr, debug_generic_stmt, debug_tree_chain): Likewise. * tree-loop-distribution.c (debug_rdg_partitions): Likewise. * cgraph.c (debug_cgraph_node, debug_cgraph): Likewise. * optabs.c (debug_optab_libfuncs): Likewise. (verify_loop_closed_ssa): Likewise. * value-prof.c (verify_histograms): Likewise. * reload.c (debug_reload_to_stream, debug_reload): Likewise. * bitmap.c (debug_bitmap_file, debug_bitmap, bitmap_print): Likewise. * cfghooks.c (verify_flow_info): Likewise. * fold-const.c (debug_fold_checksum): Likewise. * omp-low.c (debug_omp_region, debug_all_omp_regions): Likewise. * cfg.c (debug_regset, debug_flow_info, debug_bb, debug_bb_n): Likewise. * omega.c (debug_omega_problem): Likewise. * cgraphunit.c (verify_cgraph_node, verify_cgraph): Likewise. * tree-ssa-ccp.c (debug_lattice_value): Likewise. * dominance.c (verify_dominators, debug_dominance_info, debug_dominance_tree): Likewise. * df-core.c (df_insn_uid_debug, df_insn_debug, df_insn_debug_regno, * df_regno_debug, df_ref_debug, debug_df_insn, debug_df_reg, debug_df_regno, debug_df_ref, debug_df_defno, debug_df_useno, debug_df_chain): Likewise. * tree-ssa-dom.c (debug_dominator_optimization_stats): Likewise. * sel-sched.c (debug_state): Likewise. * tree-ssa-alias.c (debug_alias_info, debug_points_to_info_for): Likewise. * cfganal.c (print_edge_list, verify_edge_list): Likewise. * dwarf2out.c (debug_dwarf_die, debug_dwarf): Likewise. * tree-eh.c (verify_eh_edges, verify_eh_dispatch_edge): Likewise. * gimple-pretty-print.c (debug_gimple_stmt, debug_gimple_seq): Likewise. * c-pretty-print.c (debug_c_tree): Likewise. * sel-sched-dump.c (debug_insn_rtx, debug_vinsn, debug_expr, debug_insn debug_av_set, debug_lv_set, debug_ilist, debug_blist, debug_insn_vector, debug_hard_reg_set, debug_mem_addr_value): Likewise. * ebitmap.c (debug_ebitmap): Likewise. * function.c (debug_find_var_in_block_tree): Likewise. * print-rtl.c (debug_rtx): Likewise. (debug_rtx_count): Likewise. (debug_rtx_list, debug_rtx_range, debug_rtx_find): Likewise. * stor-layout.c (debug_rli): Likewise. * ipa.c (debug_cgraph_node_set, debug_varpool_node_set): Likewise. * tree-data-ref.c (debug_data_references, debug_data_dependence_relations, debug_data_reference, debug_data_dependence_relation, debug_rdg_vertex, debug_rdg_component, debug_rdg): Likewise. * tree-affine.c (debug_aff): Likewise. * tree-dfa.c (debug_referenced_vars, debug_variable, debug_dfa_stats): Likewise. * except.c (debug_eh_tree, verify_eh_tree): Likewise. * emit-rtl.c (verify_rtl_sharing): Likewise. * tree-ssa-pre.c (debug_pre_expr, debug_bitmap_set, debug_value_expressions): Likewise. * tree-ssa-live.c (debug_scope_block, debug_scope_blocks): Likewise. * sese.c (debug_rename_map, debug_ivtype_map): Likewise. * print-tree.c (debug_tree, debug_vec_tree): Likewise. * cfglayout.c (verify_insn_chain): Likewise. * graphite-clast-to-gimple.c (debug_clast_name_indexes, debug_clast_stmt, debug_generated_program): Likewise. * ggc-page.c (debug_print_page_list): Likewise. * tree-ssa-ter.c (debug_ter): Likewise. * graphite-dependences.c (debug_pddr): Likewise. * sched-deps.c (debug_ds): Likewise. * tree-ssa.c (verify_ssa): Likewise. * graphite-poly.c (debug_scattering_function, debug_iteration_domain, debug_scattering_functions, debug_iteration_domains, debug_pdr, debug_pdrs, debug_pbb_domain, debug_pbb, debug_scop_context, debug_scop, debug_cloog, debug_scop_params, debug_lst): Likewise. * tree-inline.c (debug_find_tree): Likewise. * graphite-ppl.c (debug_ppl_linear_expr, debug_ppl_polyhedron_matrix, debug_ppl_powerset_matrix): Likewise. * var-tracking.c (debug_dv): Likewise. * system.h (DEBUG_FUNCTION, DEBUG_VARIABLE): Define. * cfgloop.c (verify_loop_structure): Likewise. * plugin.c (dump_active_plugins, debug_active_plugins): Likewise. * c-common.c (verify_sequence_points): Likewise. * sched-rgn.c (debug_regions, debug_region, debug_candidate, debug_candidates, debug_rgn_dependencies): Likewise. * tree-ssa-structalias.c (debug_constraint, debug_constraints, * debug_constraint_graph, debug_solution_for_var, debug_sa_points_to_info): Likewise. * sched-vis.c (debug_insn_slim, debug_bb_slim, debug_bb_n_slim): Likewie. * tree-cfg.c (debug_cfg_stats, verify_stmts, debug_function, debug_loops, debug_loop, debug_loop_num): Likewise. * passes.c (debug_pass): Likewise. (dump_properties): Likewise; add cfglayout property. (debug_properties): Likewise. * tree-ssa-reassoc.c (debug_ops_vector): Likewise. * varpool.c (debug_varpool): Likewise. * regcprop.c (debug_value_data): Likewise. * tree-ssa-operands.c (verify_imm_links, debug_immediate_uses, debug_immediate_uses_for): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160036 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 10292f27a96..e510358a49b 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -358,7 +358,7 @@ dump_alias_info (FILE *file) /* Dump alias information on stderr. */ -void +DEBUG_FUNCTION void debug_alias_info (void) { dump_alias_info (stderr); @@ -437,7 +437,7 @@ dump_points_to_info_for (FILE *file, tree ptr) /* Dump points-to information for VAR into stderr. */ -void +DEBUG_FUNCTION void debug_points_to_info_for (tree var) { dump_points_to_info_for (stderr, var); -- cgit v1.2.1 From 8e3cb73bc66100e137b20bcd98316bc415b6e53c Mon Sep 17 00:00:00 2001 From: steven Date: Tue, 1 Jun 2010 22:00:56 +0000 Subject: * gimplify.c: Do not include except.h and optabs.h. (gimplify_body): Do not initialize RTL profiling. * gimple-low.c: Do not include rtl.h, diagnostic.h, langhooks.h, langhooks-def.h, timevar.h, except.h, hashtab.h, and expr.h. * gimple-fold.c: Do not include rtl.h, tm_p.h, ggc.h, basic-block.h, output.h, expr.h, diagnostic.h, timevar.h, value-prof.h, and langhooks.h. * tree-pretty-print.h: Include pretty-print.h. * gimple-pretty-print.h: Include pretty-print.h. * tree-pretty-print.c: Do not include diagnostic.h. * tree-vrp.c: Likewise. * tree-tailcall.c: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-dse.c: Likewise * tree-chrec.c: Likewise * tree-ssa-sccvn.c: Likewise * tree-ssa-copyrename.c: Likewise * tree-nomudflap.c: Likewise * tree-call-cdce.c: Likewise * tree-stdarg.c: Likewise * tree-ssa-math-opts.c: Likewise * tree-nrv.c: Likewise * tree-ssa-sink.c: Likewise * tree-browser.c: Likewise * tree-ssa-loop-ivcanon.c: Likewise * tree-ssa-loop.c: Likewise * tree-parloops.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-ifcombine.c: Likewise * tree-if-conv.c: Likewise * tree-data-ref.c: Likewise * tree-affine.c: Likewise * tree-ssa-phiopt.c: Likewise * tree-ssa-coalesce.c: Likewise * tree-ssa-pre.c: Likewise * tree-ssa-live.c: Likewise * tree-predcom.c: Likewise * tree-ssa-forwprop.c: Likewise * tree-ssa-dce.c: Likewise * tree-ssa-ter.c: Likewise * tree-ssa-loop-prefetch.c: Likewise * tree-optimize.c: Likewise * tree-ssa-phiprop.c: Likewise * tree-object-size.c: Likewise * tree-outof-ssa.c: Likewise * tree-ssa-structalias.c: Likewise * tree-switch-conversion.c: Likewise * tree-ssa-reassoc.c: Likewise * tree-ssa-operands.c: Likewise * tree-vectorizer.c: Likewise * tree-vect-data-refs.c: Likewise * tree-vect-generic.c: Likewise * tree-vect-stmts.c: Likewise * tree-vect-patterns.c: Likewise * tree-vect-slp.c: Likewise * tree-vect-loop.c: Likewise * tree-ssa-loop-ivopts.c: Likewise * tree-ssa-loop-im.c: Likewise * tree-ssa-loop-niter.c: Likewise * tree-ssa-loop-unswitch.c: Likewise * tree-ssa-loop-manip.c: Likewise * tree-ssa-loop-ch.c: Likewise * tree-dump.c: Likewise * tree-complex.c: Likewise * tree-into-ssa.c: Do not include diagnostic.h and expr.h. * tree-ssa-uninit.c: Likewise * tree-ssa-threadupdate.c: Likewise * tree-ssa-uncprop.c: Likewise * tree-ssa-ccp.c: Likewise * tree-ssa-dom.c: Likewise * tree-ssa-propagate.c: Likewise * tree-ssa-alias.c: Likewise * tree-dfa.c: Likewise * tree-cfgcleanup.c: Likewise * tree-sra.c: Likewise * tree-ssa-copy.c: Likewise * tree-ssa.c: Likewise * tree-profile.c: Likewise * tree-cfg.c: Likewise * tree-ssa-threadedge.c: Likewise * tree-vect-loop-manip.c: Likewise * tree-inline.c: Do not include diagnostic.h and expr.h. Include rtl.h. (copy_decl_for_dup_finish): Do not use NULL_RTX. * tree-loop-linear.c: Do not include diagnostic.h, expr.h, and optabs.h. * tree-loop-distribution.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160125 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e510358a49b..d3890c5b57c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -27,12 +27,10 @@ along with GCC; see the file COPYING3. If not see #include "tm_p.h" #include "basic-block.h" #include "timevar.h" -#include "expr.h" #include "ggc.h" #include "langhooks.h" #include "flags.h" #include "function.h" -#include "diagnostic.h" #include "tree-pretty-print.h" #include "tree-dump.h" #include "gimple.h" -- cgit v1.2.1 From ba72912a012b97cad825eebee3f5f22253d0afe4 Mon Sep 17 00:00:00 2001 From: lauras Date: Tue, 8 Jun 2010 07:25:24 +0000 Subject: gcc/ada: 2010-06-08 Laurynas Biveinis * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC allocation. (init_dummy_type): Likewise. (gnat_pushlevel): Likewise. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. (extract_encoding): Likewise. (decode_name): Likewise. * gcc-interface/misc.c (gnat_printable_name): Likewise. * gcc-interface/decl.c (annotate_value): Likewise. * gcc-interface/ada-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation. (SET_DECL_LANG_SPECIFIC): Likewise. gcc/c-family: 2010-06-08 Laurynas Biveinis * c-pragma.c (push_alignment): Use typed GC allocation. (handle_pragma_push_options): Likewise. * c-common.c (parse_optimize_options): Likewise. * c-common.h (struct sorted_fields_type): Add variable_size GTY option. gcc/cp: 2010-06-08 Laurynas Biveinis * typeck2.c (abstract_virtuals_error): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class): Likewise. (push_tinst_level): Likewise. * parser.c (cp_lexer_new_main): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * decl.c (make_label_decl): Likewise. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * class.c (finish_struct_1): Likewise. * cp-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * parser.c (cp_parser_new): Update comment to not reference ggc_alloc. gcc/fortran: 2010-06-08 Laurynas Biveinis * trans-types.c (gfc_get_nodesc_array_type): Use typed GC allocation. (gfc_get_array_type_bounds): Likewise. * trans-decl.c (gfc_allocate_lang_decl): Likewise. (gfc_find_module): Likewise. * f95-lang.c (pushlevel): Likewise. * trans.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. gcc/java: 2010-06-08 Laurynas Biveinis * jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation. * jcf-parse.c (java_parse_file): Likewise. (process_zip_dir): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise. * expr.c (add_type_assertion): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * class.c (add_method_1): Likewise. (java_treetreehash_new): Likewise. * java-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * jch.h (struct cpool_entry): Likewise. * java-tree.h (java_treetreehash_create): Remove parameter ggc. * except.c (prepare_eh_table_type): Update java_treetreehash_create call. * class.c (add_method_1): Update java_treetreehash_create call. (java_treetreehash_create): Remove parameter gc. Use htab_create_ggc. gcc/lto: 2010-06-08 Laurynas Biveinis * lto.c (lto_read_in_decl_state): Use typed GC allocation. (lto_file_read): Likewise. (new_partition): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objc: 2010-06-08 Laurynas Biveinis * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. * objc-act.c (objc_volatilize_decl): Likewise. (objc_build_string_object): Likewise. (hash_init): Likewise. (hash_enter): Likewise. (hash_add_attr): Likewise. (add_class): Likewise. (start_class): Likewise. gcc/objcp: 2010-06-08 Laurynas Biveinis * objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. gcc: 2010-06-08 Laurynas Biveinis * doc/tm.texi (Per-Function Data): Do not reference ggc_alloc. * doc/gty.texi (GTY Options): Document typed GC allocation and variable_size GTY option. * ggc-internal.h: New. * ggc.h: Update copyright year. (digit_string): Move to stringpool.c. (ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots) (gt_pch_save_stringpool, gt_pch_fixup_stringpool) (gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object) (init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size) (ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write) (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read) (ggc_force_collect, ggc_get_size, ggc_statistics) (ggc_print_common_statistics): Move to ggc-internal.h. (digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat) (ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW) (GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec) (ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic) (ggc_min_heapsize_heuristic, ggc_alloc_zone) (ggc_alloc_zone_pass_stat): Remove. (ggc_internal_alloc_stat, ggc_internal_alloc) (ggc_internal_cleared_alloc_stat): New. (GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine. (ggc_internal_vec_alloc_stat) (ggc_internal_cleared_vec_alloc_stat) (ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc) (ggc_alloc_atomic_stat, ggc_alloc_atomic) (ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args) (ggc_cleared_alloc_ptr_array_two_args): New. (htab_create_ggc, splay_tree_new_ggc): Redefine. (ggc_splay_alloc): Change the type of the first argument to enum gt_types_enum. (ggc_alloc_string): Make macro. (ggc_alloc_string_stat): New. (ggc_strdup): Redefine. (rtl_zone, tree_zone, tree_id_zone): Declare unconditionally. (ggc_alloc_rtvec_sized): New. (ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat) (ggc_internal_cleared_alloc_zone_stat) (ggc_internal_zone_alloc_stat) (ggc_internal_zone_cleared_alloc_stat) (ggc_internal_zone_vec_alloc_stat) (ggc_alloc_zone_rtx_def_stat) (ggc_alloc_zone_tree_node_stat) (ggc_alloc_zone_cleared_tree_node_stat) (ggc_alloc_cleared_gimple_statement_d_stat): New. * ggc-common.c: Include ggc-internal.h. (ggc_internal_cleared_alloc_stat): Rename from ggc_alloc_cleared_stat. (ggc_realloc_stat): Use ggc_internal_alloc_stat. (ggc_calloc): Remove. (ggc_cleared_alloc_htab_ignore_args): New. (ggc_cleared_alloc_ptr_array_two_args): New. (ggc_splay_alloc): Add obj_type parameter. (init_ggc_heuristics): Formatting fixes. * ggc-none.c: Update copyright year. (ggc_alloc_stat): Rename to ggc_alloc_stat. (ggc_alloc_cleared_stat): Rename to ggc_internal_cleared_alloc_stat. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-page.c: Update copyright year. Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_typed_stat): Call ggc_internal_alloc_stat. (ggc_alloc_stat): Rename to ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-zone.c: Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat): New. (ggc_internal_cleared_alloc_zone_stat): New. (ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat. (ggc_alloc_stat): Rename ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. * stringpool.c: Update copyright year. Include ggc-internal.h (digit_vector): Make static. (digit_string): Moved from ggc.h. (stringpool_ggc_alloc): Use ggc_alloc_atomic. (ggc_alloc_string): Rename to ggc_alloc_string_stat. * Makefile.in (GGC_INTERNAL_H): New. (ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add $(GGC_INTERNAL_H) to dependencies. * gentype.c: Update copyright year. (walk_type): Accept variable_size GTY option. (USED_BY_TYPED_GC_P): New macro. (write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output whitespace at the end of strings. (get_type_specifier, variable_size_p): New functions. (alloc_quantity, alloc_zone): New enums. (write_typed_alloc_def): New function. (write_typed_struct_alloc_def): Likewise. (write_typed_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (output_typename, write_splay_tree_allocator_def): Likewise. (write_splay_tree_allocators): Likewise. (main): Call write_typed_alloc_defns and write_splay_tree_allocators. * lto-streamer.h (lto_file_decl_data_ptr): New. * passes.c (order): Define using cgraph_node_ptr. * strinpool.c (struct string_pool_data): Declare nested_ptr using ht_identifier_ptr. * gimple.h (union gimple_statement_d): Likewise. * rtl.h (struct rtx_def): Likewise. (struct rtvec_def): Likewise. * tree.h (union tree_node): Likewise. * tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise. * cfgloop.c (record_loop_exits): Use htab_create_ggc. * tree-scalar-evolution.c (scev_initialize): Likewise. * alias.c (record_alias_subset): Update splay_tree_new_ggc call. * dwarf2asm.c (dw2_force_const_mem): Likewise. * omp-low.c (lower_omp_critical): Likewise. * bitmap.h (struct bitmap_head_def): Update comment to not reference ggc_alloc. * config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC. * ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC. * ipa-prop.c (duplicate_ggc_array): Rename to duplicate_ipa_jump_func_array. Use typed GC allocation. (ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array. * gimple.c (gimple_alloc_stat): Use ggc_alloc_cleared_gimple_statement_d_stat. * varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def. * tree.c (make_node_stat): Use ggc_alloc_zone_cleared_tree_node_stat. (make_tree_vec_stat): Likewise. (build_vl_exp_stat): Likewise. (copy_node_stat): Use ggc_alloc_zone_tree_node_stat. (make_tree_binfo_stat): Likewise. (tree_cons_stat): Likewise. * rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat. (shallow_copy_rtx_stat): Likewise. (make_node_stat): Likewise. * lto-symtab.c: Fix comment. * tree-cfg.c (create_bb): Update comment to not reference ggc_alloc_cleared. * tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is value. * varpool.c (varpool_node): Use typed GC allocation. (varpool_extra_name_alias): Likewise. * varasm.c (emutls_decl): Likewise. (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. * tree.c (build_vl_exp_stat): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. * tree-ssa-structalias.c (heapvar_insert): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-alias.c (get_ptr_info): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-dfa.c (create_var_ann): Likewise. * tree-cfg.c (create_bb): Likewise. * toplev.c (alloc_for_identifier_to_locale): Likewise. (general_init): Likewise. * stringpool.c (stringpool_ggc_alloc): Likewise. (gt_pch_save_stringpool): Likewise. * sese.c (if_region_set_false_region): Likewise. * passes.c (do_per_function_toporder): Likewise. * optabs.c (set_optab_libfunc): Likewise. (set_conv_libfunc): Likewise. * lto-symtab.c (lto_symtab_register_decl): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (make_new_block): Likewise. (unpack_ts_real_cst_value_fields): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * lambda.h (lambda_vector_new): Likewise. * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise. * ira.c (update_equiv_regs): Likewise. * ipa.c (cgraph_node_set_new): Likewise. (cgraph_node_set_add): Likewise. (varpool_node_set_new): Likewise. (varpool_node_set_add): Likewise. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise. (duplicate_ipa_jump_func_array): Likewise. (ipa_read_node_info): Likewise. * ipa-cp.c (ipcp_create_replace_map): Likewise. * integrate.c (get_hard_reg_initial_val): Likewise. * gimple.c (gimple_alloc_stat): Likewise. (gimple_build_omp_for): Likewise. (gimple_seq_alloc): Likewise. (gimple_copy): Likewise. * gimple-iterator.c (gsi_insert_before_without_update): Likewise. (gsi_insert_after_without_update): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (allocate_struct_function): Likewise. (types_used_by_var_decl_insert): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * emit-rtl.c (get_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. * dwarf2out.c (new_cfi): Likewise. (queue_reg_save): Likewise. (dwarf2out_frame_init): Likewise. (new_loc_descr): Likewise. (find_AT_string): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (loc_descriptor): Likewise. (add_loc_descr_to_each): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (add_comp_dir_attribute): Likewise. (add_name_and_src_coords_attributes): Likewise. (lookup_filename): Likewise. (store_vcall_insn): Likewise. (dwarf2out_init): Likewise. * dbxout.c (dbxout_init): Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/score/score7.c (score7_output_external): Likewise. * config/score/score3.c (score3_output_external): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (get_deferred_plabel): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_need_linkage): Likewise. (alpha_use_linkage): Likewise. * cgraph.c (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_create_indirect_edge): Likewise. (cgraph_add_asm_node): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cfgloop.c (alloc_loop): Likewise. (rescan_loop_exit): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * c-parser.c (c_parse_init): Likewise. (c_parse_file): Likewise. * c-decl.c (bind): Likewise. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (c_push_function_context): Likewise. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * alias.c (record_alias_subset): Likewise. (init_alias_analysis): Likewise. include: 2010-06-08 Laurynas Biveinis * splay-tree.h: Update copyright years. (splay_tree_s): Document fields. (splay_tree_new_typed_alloc): New. * hashtab.h: Update copyright years. (htab_create_typed_alloc): New. libcpp: 2010-06-08 Laurynas Biveinis * include/symtab.h (ht_identifier_ptr): New. libiberty: 2010-06-08 Laurynas Biveinis * splay-tree.c: Update copyright years. (splay_tree_new_typed_alloc): New. (splay_tree_new_with_allocator): Use it. * hashtab.c: Update copyright years. (htab_create_typed_alloc): New. (htab_create_alloc): Use it. * functions.texi: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160425 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index d3890c5b57c..e6836d77409 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -376,7 +376,7 @@ get_ptr_info (tree t) pi = SSA_NAME_PTR_INFO (t); if (pi == NULL) { - pi = GGC_CNEW (struct ptr_info_def); + pi = ggc_alloc_cleared_ptr_info_def (); pt_solution_reset (&pi->pt); SSA_NAME_PTR_INFO (t) = pi; } -- cgit v1.2.1 From c78d5cecf99f1614e0425d4609315baa0ae6eebf Mon Sep 17 00:00:00 2001 From: rguenth Date: Sat, 26 Jun 2010 13:24:57 +0000 Subject: 2010-06-26 Richard Guenther PR middle-end/44674 * tree-ssa-alias.c (refs_may_alias_p_1): Allow all kind of decls. Handle LABEL_DECLs like FUNCTION_DECLs. * gcc.dg/pr44674.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161431 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index e6836d77409..95f26f1ed0a 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -800,18 +800,16 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) bool var1_p, var2_p, ind1_p, ind2_p; alias_set_type set; - gcc_assert ((!ref1->ref - || SSA_VAR_P (ref1->ref) - || handled_component_p (ref1->ref) - || INDIRECT_REF_P (ref1->ref) - || TREE_CODE (ref1->ref) == TARGET_MEM_REF - || TREE_CODE (ref1->ref) == CONST_DECL) - && (!ref2->ref - || SSA_VAR_P (ref2->ref) - || handled_component_p (ref2->ref) - || INDIRECT_REF_P (ref2->ref) - || TREE_CODE (ref2->ref) == TARGET_MEM_REF - || TREE_CODE (ref2->ref) == CONST_DECL)); + gcc_checking_assert ((!ref1->ref + || DECL_P (ref1->ref) + || handled_component_p (ref1->ref) + || INDIRECT_REF_P (ref1->ref) + || TREE_CODE (ref1->ref) == TARGET_MEM_REF) + && (!ref2->ref + || DECL_P (ref2->ref) + || handled_component_p (ref2->ref) + || INDIRECT_REF_P (ref2->ref) + || TREE_CODE (ref2->ref) == TARGET_MEM_REF)); /* Decompose the references into their base objects and the access. */ base1 = ao_ref_base (ref1); @@ -832,10 +830,13 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) || is_gimple_min_invariant (base2)) return false; - /* We can end up refering to code via function decls. As we likely - do not properly track code aliases conservatively bail out. */ + /* We can end up refering to code via function and label decls. + As we likely do not properly track code aliases conservatively + bail out. */ if (TREE_CODE (base1) == FUNCTION_DECL - || TREE_CODE (base2) == FUNCTION_DECL) + || TREE_CODE (base2) == FUNCTION_DECL + || TREE_CODE (base1) == LABEL_DECL + || TREE_CODE (base2) == LABEL_DECL) return true; /* Defer to simple offset based disambiguation if we have -- cgit v1.2.1 From 8e7c2b9c94b04b1911dac37bb663c710920ad54e Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 27 Jun 2010 08:10:45 +0000 Subject: 2010-06-27 Richard Guenther PR middle-end/44684 * tree-ssa-alias.c (refs_may_alias_p_1): Allow SSA name refs. (stmt_may_clobber_ref_p_1): Do not bother to call the oracle for register LHS. Or non-store assignments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161456 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 95f26f1ed0a..28b8fb779c2 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -801,11 +801,13 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) alias_set_type set; gcc_checking_assert ((!ref1->ref + || TREE_CODE (ref1->ref) == SSA_NAME || DECL_P (ref1->ref) || handled_component_p (ref1->ref) || INDIRECT_REF_P (ref1->ref) || TREE_CODE (ref1->ref) == TARGET_MEM_REF) && (!ref2->ref + || TREE_CODE (ref2->ref) == SSA_NAME || DECL_P (ref2->ref) || handled_component_p (ref2->ref) || INDIRECT_REF_P (ref2->ref) @@ -1409,11 +1411,15 @@ stmt_may_clobber_ref_p_1 (gimple stmt, ao_ref *ref) return call_may_clobber_ref_p_1 (stmt, ref); } - else if (is_gimple_assign (stmt)) + else if (gimple_assign_single_p (stmt)) { - ao_ref r; - ao_ref_init (&r, gimple_assign_lhs (stmt)); - return refs_may_alias_p_1 (ref, &r, true); + tree lhs = gimple_assign_lhs (stmt); + if (!is_gimple_reg (lhs)) + { + ao_ref r; + ao_ref_init (&r, gimple_assign_lhs (stmt)); + return refs_may_alias_p_1 (ref, &r, true); + } } else if (gimple_code (stmt) == GIMPLE_ASM) return true; -- cgit v1.2.1 From 182cf5a9a415f31df0f9a10e46faed1221484a35 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 1 Jul 2010 08:49:19 +0000 Subject: 2010-07-01 Richard Guenther PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR > to MEM_REF . (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161655 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 238 +++++++++++++++++++++++++++++---------------------- 1 file changed, 136 insertions(+), 102 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 28b8fb779c2..78eb362ca5c 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -182,7 +182,8 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl) { tree base = get_base_address (TREE_OPERAND (ptr, 0)); if (base - && INDIRECT_REF_P (base)) + && (INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF)) ptr = TREE_OPERAND (base, 0); else if (base && SSA_VAR_P (base)) @@ -238,7 +239,8 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) { tree base = get_base_address (TREE_OPERAND (ptr1, 0)); if (base - && INDIRECT_REF_P (base)) + && (INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF)) ptr1 = TREE_OPERAND (base, 0); else if (base && SSA_VAR_P (base)) @@ -250,7 +252,8 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2) { tree base = get_base_address (TREE_OPERAND (ptr2, 0)); if (base - && INDIRECT_REF_P (base)) + && (INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF)) ptr2 = TREE_OPERAND (base, 0); else if (base && SSA_VAR_P (base)) @@ -299,7 +302,8 @@ ptr_deref_may_alias_ref_p_1 (tree ptr, ao_ref *ref) { tree base = ao_ref_base (ref); - if (INDIRECT_REF_P (base)) + if (INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF) return ptr_derefs_may_alias_p (ptr, TREE_OPERAND (base, 0)); else if (SSA_VAR_P (base)) return ptr_deref_may_alias_decl_p (ptr, base); @@ -470,12 +474,18 @@ ao_ref_base (ao_ref *ref) /* Returns the base object alias set of the memory reference *REF. */ -static alias_set_type ATTRIBUTE_UNUSED +static alias_set_type ao_ref_base_alias_set (ao_ref *ref) { + tree base_ref; if (ref->base_alias_set != -1) return ref->base_alias_set; - ref->base_alias_set = get_alias_set (ao_ref_base (ref)); + if (!ref->ref) + return 0; + base_ref = ref->ref; + while (handled_component_p (base_ref)) + base_ref = TREE_OPERAND (base_ref, 0); + ref->base_alias_set = get_alias_set (base_ref); return ref->base_alias_set; } @@ -505,7 +515,8 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size) &ref->offset, &t1, &t2); else { - ref->base = build1 (INDIRECT_REF, char_type_node, ptr); + ref->base = build2 (MEM_REF, char_type_node, + ptr, build_int_cst (ptr_type_node, 0)); ref->offset = 0; } if (size @@ -665,33 +676,45 @@ decl_refs_may_alias_p (tree base1, if non-NULL are the complete memory reference trees. */ static bool -indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, - HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, +indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, + HOST_WIDE_INT offset1, + HOST_WIDE_INT max_size1 ATTRIBUTE_UNUSED, alias_set_type ref1_alias_set, alias_set_type base1_alias_set, - tree ref2, tree base2, + tree ref2 ATTRIBUTE_UNUSED, tree base2, HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2, alias_set_type ref2_alias_set, - alias_set_type base2_alias_set) + alias_set_type base2_alias_set, bool tbaa_p) { + tree ptr1 = TREE_OPERAND (base1, 0); + tree ptrtype1; + HOST_WIDE_INT offset1p = offset1; + + if (TREE_CODE (base1) == MEM_REF) + offset1p = offset1 + mem_ref_offset (base1).low * BITS_PER_UNIT; + /* If only one reference is based on a variable, they cannot alias if the pointer access is beyond the extent of the variable access. (the pointer base cannot validly point to an offset less than zero of the variable). They also cannot alias if the pointer may not point to the decl. */ - if (max_size2 != -1 - && !ranges_overlap_p (offset1, max_size1, 0, offset2 + max_size2)) + if (!ranges_overlap_p (MAX (0, offset1p), -1, offset2, max_size2)) return false; if (!ptr_deref_may_alias_decl_p (ptr1, base2)) return false; /* Disambiguations that rely on strict aliasing rules follow. */ - if (!flag_strict_aliasing) + if (!flag_strict_aliasing || !tbaa_p) return true; + if (TREE_CODE (base1) == MEM_REF) + ptrtype1 = TREE_TYPE (TREE_OPERAND (base1, 1)); + else + ptrtype1 = TREE_TYPE (ptr1); + /* If the alias set for a pointer access is zero all bets are off. */ if (base1_alias_set == -1) - base1_alias_set = get_deref_alias_set (ptr1); + base1_alias_set = get_deref_alias_set (ptrtype1); if (base1_alias_set == 0) return true; if (base2_alias_set == -1) @@ -699,22 +722,52 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, /* If both references are through the same type, they do not alias if the accesses do not overlap. This does extra disambiguation - for mixed/pointer accesses but requires strict aliasing. */ - if (same_type_for_tbaa (TREE_TYPE (TREE_TYPE (ptr1)), - TREE_TYPE (base2)) == 1) + for mixed/pointer accesses but requires strict aliasing. + For MEM_REFs we require that the component-ref offset we computed + is relative to the start of the type which we ensure by + comparing rvalue and access type and disregarding the constant + pointer offset. */ + if ((TREE_CODE (base1) != MEM_REF + || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) + && same_type_for_tbaa (TREE_TYPE (ptrtype1), TREE_TYPE (base2)) == 1) return ranges_overlap_p (offset1, max_size1, offset2, max_size2); - /* The only way to access a variable is through a pointer dereference - of the same alias set or a subset of it. */ + /* When we are trying to disambiguate an access with a pointer dereference + as base versus one with a decl as base we can use both the size + of the decl and its dynamic type for extra disambiguation. + ??? We do not know anything about the dynamic type of the decl + other than that its alias-set contains base2_alias_set as a subset + which does not help us here. */ + /* As we know nothing useful about the dynamic type of the decl just + use the usual conflict check rather than a subset test. + ??? We could introduce -fvery-strict-aliasing when the language + does not allow decls to have a dynamic type that differs from their + static type. Then we can check + !alias_set_subset_of (base1_alias_set, base2_alias_set) instead. */ if (base1_alias_set != base2_alias_set - && !alias_set_subset_of (base1_alias_set, base2_alias_set)) + && !alias_sets_conflict_p (base1_alias_set, base2_alias_set)) + return false; + /* If the size of the access relevant for TBAA through the pointer + is bigger than the size of the decl we can't possibly access the + decl via that pointer. */ + if (DECL_SIZE (base2) && COMPLETE_TYPE_P (TREE_TYPE (ptrtype1)) + && TREE_CODE (DECL_SIZE (base2)) == INTEGER_CST + && TREE_CODE (TYPE_SIZE (TREE_TYPE (ptrtype1))) == INTEGER_CST + /* ??? This in turn may run afoul when a decl of type T which is + a member of union type U is accessed through a pointer to + type U and sizeof T is smaller than sizeof U. */ + && TREE_CODE (TREE_TYPE (ptrtype1)) != UNION_TYPE + && TREE_CODE (TREE_TYPE (ptrtype1)) != QUAL_UNION_TYPE + && tree_int_cst_lt (DECL_SIZE (base2), TYPE_SIZE (TREE_TYPE (ptrtype1)))) return false; /* Do access-path based disambiguation. */ if (ref1 && ref2 && handled_component_p (ref1) - && handled_component_p (ref2)) - return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), + && handled_component_p (ref2) + && (TREE_CODE (base1) != MEM_REF + || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1)) + return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1), ref1_alias_set, base1_alias_set, offset1, max_size1, ref2, TREE_TYPE (base2), @@ -732,42 +785,65 @@ indirect_ref_may_alias_decl_p (tree ref1, tree ptr1, if non-NULL are the complete memory reference trees. */ static bool -indirect_refs_may_alias_p (tree ref1, tree ptr1, +indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, HOST_WIDE_INT offset1, HOST_WIDE_INT max_size1, alias_set_type ref1_alias_set, alias_set_type base1_alias_set, - tree ref2, tree ptr2, + tree ref2 ATTRIBUTE_UNUSED, tree base2, HOST_WIDE_INT offset2, HOST_WIDE_INT max_size2, alias_set_type ref2_alias_set, - alias_set_type base2_alias_set) + alias_set_type base2_alias_set, bool tbaa_p) { + tree ptr1 = TREE_OPERAND (base1, 0); + tree ptr2 = TREE_OPERAND (base2, 0); + tree ptrtype1, ptrtype2; + /* If both bases are based on pointers they cannot alias if they may not point to the same memory object or if they point to the same object and the accesses do not overlap. */ if (operand_equal_p (ptr1, ptr2, 0)) - return ranges_overlap_p (offset1, max_size1, offset2, max_size2); + { + if (TREE_CODE (base1) == MEM_REF) + offset1 += mem_ref_offset (base1).low * BITS_PER_UNIT; + if (TREE_CODE (base2) == MEM_REF) + offset2 += mem_ref_offset (base2).low * BITS_PER_UNIT; + return ranges_overlap_p (offset1, max_size1, offset2, max_size2); + } if (!ptr_derefs_may_alias_p (ptr1, ptr2)) return false; /* Disambiguations that rely on strict aliasing rules follow. */ - if (!flag_strict_aliasing) + if (!flag_strict_aliasing || !tbaa_p) return true; + if (TREE_CODE (base1) == MEM_REF) + ptrtype1 = TREE_TYPE (TREE_OPERAND (base1, 1)); + else + ptrtype1 = TREE_TYPE (ptr1); + if (TREE_CODE (base2) == MEM_REF) + ptrtype2 = TREE_TYPE (TREE_OPERAND (base2, 1)); + else + ptrtype2 = TREE_TYPE (ptr2); + /* If the alias set for a pointer access is zero all bets are off. */ if (base1_alias_set == -1) - base1_alias_set = get_deref_alias_set (ptr1); + base1_alias_set = get_deref_alias_set (ptrtype1); if (base1_alias_set == 0) return true; if (base2_alias_set == -1) - base2_alias_set = get_deref_alias_set (ptr2); + base2_alias_set = get_deref_alias_set (ptrtype2); if (base2_alias_set == 0) return true; /* If both references are through the same type, they do not alias if the accesses do not overlap. This does extra disambiguation for mixed/pointer accesses but requires strict aliasing. */ - if (same_type_for_tbaa (TREE_TYPE (TREE_TYPE (ptr1)), - TREE_TYPE (TREE_TYPE (ptr2))) == 1) + if ((TREE_CODE (base1) != MEM_REF + || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) + && (TREE_CODE (base2) != MEM_REF + || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1) + && same_type_for_tbaa (TREE_TYPE (ptrtype1), + TREE_TYPE (ptrtype2)) == 1) return ranges_overlap_p (offset1, max_size1, offset2, max_size2); /* Do type-based disambiguation. */ @@ -778,11 +854,15 @@ indirect_refs_may_alias_p (tree ref1, tree ptr1, /* Do access-path based disambiguation. */ if (ref1 && ref2 && handled_component_p (ref1) - && handled_component_p (ref2)) - return aliasing_component_refs_p (ref1, TREE_TYPE (TREE_TYPE (ptr1)), + && handled_component_p (ref2) + && (TREE_CODE (base1) != MEM_REF + || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) + && (TREE_CODE (base2) != MEM_REF + || same_type_for_tbaa (TREE_TYPE (base2), TREE_TYPE (ptrtype2)) == 1)) + return aliasing_component_refs_p (ref1, TREE_TYPE (ptrtype1), ref1_alias_set, base1_alias_set, offset1, max_size1, - ref2, TREE_TYPE (TREE_TYPE (ptr2)), + ref2, TREE_TYPE (ptrtype2), ref2_alias_set, base2_alias_set, offset2, max_size2, false); @@ -798,19 +878,20 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) HOST_WIDE_INT offset1 = 0, offset2 = 0; HOST_WIDE_INT max_size1 = -1, max_size2 = -1; bool var1_p, var2_p, ind1_p, ind2_p; - alias_set_type set; gcc_checking_assert ((!ref1->ref || TREE_CODE (ref1->ref) == SSA_NAME || DECL_P (ref1->ref) || handled_component_p (ref1->ref) || INDIRECT_REF_P (ref1->ref) + || TREE_CODE (ref1->ref) == MEM_REF || TREE_CODE (ref1->ref) == TARGET_MEM_REF) && (!ref2->ref || TREE_CODE (ref2->ref) == SSA_NAME || DECL_P (ref2->ref) || handled_component_p (ref2->ref) || INDIRECT_REF_P (ref2->ref) + || TREE_CODE (ref2->ref) == MEM_REF || TREE_CODE (ref2->ref) == TARGET_MEM_REF)); /* Decompose the references into their base objects and the access. */ @@ -851,8 +932,9 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) return decl_refs_may_alias_p (base1, offset1, max_size1, base2, offset2, max_size2); - ind1_p = INDIRECT_REF_P (base1); - ind2_p = INDIRECT_REF_P (base2); + ind1_p = INDIRECT_REF_P (base1) || (TREE_CODE (base1) == MEM_REF); + ind2_p = INDIRECT_REF_P (base2) || (TREE_CODE (base2) == MEM_REF); + /* Canonicalize the pointer-vs-decl case. */ if (ind1_p && var2_p) { @@ -869,59 +951,6 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) ind2_p = true; } - /* If we are about to disambiguate pointer-vs-decl try harder to - see must-aliases and give leeway to some invalid cases. - This covers a pretty minimal set of cases only and does not - when called from the RTL oracle. It handles cases like - - int i = 1; - return *(float *)&i; - - and also fixes gfortran.dg/lto/pr40725. */ - if (var1_p && ind2_p - && cfun - && gimple_in_ssa_p (cfun) - && TREE_CODE (TREE_OPERAND (base2, 0)) == SSA_NAME) - { - gimple def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (base2, 0)); - while (is_gimple_assign (def_stmt) - && (gimple_assign_rhs_code (def_stmt) == SSA_NAME - || CONVERT_EXPR_CODE_P (gimple_assign_rhs_code (def_stmt)))) - { - tree rhs = gimple_assign_rhs1 (def_stmt); - HOST_WIDE_INT offset, size, max_size; - - /* Look through SSA name copies and pointer conversions. */ - if (TREE_CODE (rhs) == SSA_NAME - && POINTER_TYPE_P (TREE_TYPE (rhs))) - { - def_stmt = SSA_NAME_DEF_STMT (rhs); - continue; - } - if (TREE_CODE (rhs) != ADDR_EXPR) - break; - - /* If the pointer is defined as an address based on a decl - use plain offset disambiguation and ignore TBAA. */ - rhs = TREE_OPERAND (rhs, 0); - rhs = get_ref_base_and_extent (rhs, &offset, &size, &max_size); - if (SSA_VAR_P (rhs)) - { - base2 = rhs; - offset2 += offset; - if (size != max_size - || max_size == -1) - max_size2 = -1; - return decl_refs_may_alias_p (base1, offset1, max_size1, - base2, offset2, max_size2); - } - - /* Do not continue looking through &p->x to limit time - complexity. */ - break; - } - } - /* First defer to TBAA if possible. */ if (tbaa_p && flag_strict_aliasing @@ -937,21 +966,23 @@ refs_may_alias_p_1 (ao_ref *ref1, ao_ref *ref2, bool tbaa_p) return true; /* Dispatch to the pointer-vs-decl or pointer-vs-pointer disambiguators. */ - set = tbaa_p ? -1 : 0; if (var1_p && ind2_p) - return indirect_ref_may_alias_decl_p (ref2->ref, TREE_OPERAND (base2, 0), + return indirect_ref_may_alias_decl_p (ref2->ref, base2, offset2, max_size2, - ao_ref_alias_set (ref2), set, + ao_ref_alias_set (ref2), -1, ref1->ref, base1, offset1, max_size1, - ao_ref_alias_set (ref1), set); + ao_ref_alias_set (ref1), + ao_ref_base_alias_set (ref1), + tbaa_p); else if (ind1_p && ind2_p) - return indirect_refs_may_alias_p (ref1->ref, TREE_OPERAND (base1, 0), + return indirect_refs_may_alias_p (ref1->ref, base1, offset1, max_size1, - ao_ref_alias_set (ref1), set, - ref2->ref, TREE_OPERAND (base2, 0), + ao_ref_alias_set (ref1), -1, + ref2->ref, base2, offset2, max_size2, - ao_ref_alias_set (ref2), set); + ao_ref_alias_set (ref2), -1, + tbaa_p); gcc_unreachable (); } @@ -1110,7 +1141,8 @@ ref_maybe_used_by_call_p_1 (gimple call, ao_ref *ref) if (pt_solution_includes (gimple_call_use_set (call), base)) return true; } - else if (INDIRECT_REF_P (base) + else if ((INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) { struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); @@ -1281,7 +1313,8 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) if (DECL_P (base) && !TREE_STATIC (base)) return true; - else if (INDIRECT_REF_P (base) + else if ((INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME && (pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)))) return pi->pt.anything || pi->pt.nonlocal; @@ -1360,7 +1393,8 @@ call_may_clobber_ref_p_1 (gimple call, ao_ref *ref) /* Check if the base variable is call-clobbered. */ if (DECL_P (base)) return pt_solution_includes (gimple_call_clobber_set (call), base); - else if (INDIRECT_REF_P (base) + else if ((INDIRECT_REF_P (base) + || TREE_CODE (base) == MEM_REF) && TREE_CODE (TREE_OPERAND (base, 0)) == SSA_NAME) { struct ptr_info_def *pi = SSA_NAME_PTR_INFO (TREE_OPERAND (base, 0)); -- cgit v1.2.1 From b5c3c805858f8ae35877eba8e9f58c716e43f29c Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 8 Jul 2010 09:09:15 +0000 Subject: 2010-07-08 Richard Guenther PR rtl-optimization/44838 * tree-ssa-alias.c (indirect_refs_may_alias_p): When not in SSA form do not use pointer equivalence. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161945 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 78eb362ca5c..24608048458 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -801,7 +801,8 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, /* If both bases are based on pointers they cannot alias if they may not point to the same memory object or if they point to the same object and the accesses do not overlap. */ - if (operand_equal_p (ptr1, ptr2, 0)) + if ((!cfun || gimple_in_ssa_p (cfun)) + && operand_equal_p (ptr1, ptr2, 0)) { if (TREE_CODE (base1) == MEM_REF) offset1 += mem_ref_offset (base1).low * BITS_PER_UNIT; -- cgit v1.2.1 From 7749ee1c71ca72d9c6052d3b17666de01fe0b2b9 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 9 Jul 2010 11:24:09 +0000 Subject: 2010-07-09 Richard Guenther PR tree-optimization/44852 * tree-ssa-alias.c: Include toplev.h for exact_log2. (indirect_ref_may_alias_decl_p): Properly handle negative offsets in MEM_REF. (indirect_refs_may_alias_p): Likewise. * Makefile.in (tree-ssa-alias.o): Add $(TOPLEV_H). * gcc.c-torture/execute/pr44852.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161994 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 45 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 5 deletions(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index 24608048458..d73ff5965f0 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "langhooks.h" #include "flags.h" +#include "toplev.h" #include "function.h" #include "tree-pretty-print.h" #include "tree-dump.h" @@ -688,17 +689,29 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, { tree ptr1 = TREE_OPERAND (base1, 0); tree ptrtype1; - HOST_WIDE_INT offset1p = offset1; + HOST_WIDE_INT offset1p = offset1, offset2p = offset2; + /* The offset embedded in MEM_REFs can be negative. Bias them + so that the resulting offset adjustment is positive. */ if (TREE_CODE (base1) == MEM_REF) - offset1p = offset1 + mem_ref_offset (base1).low * BITS_PER_UNIT; + { + double_int moff = mem_ref_offset (base1); + moff = double_int_lshift (moff, + BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT, true); + if (double_int_negative_p (moff)) + offset2p += double_int_neg (moff).low; + else + offset1p += moff.low; + } /* If only one reference is based on a variable, they cannot alias if the pointer access is beyond the extent of the variable access. (the pointer base cannot validly point to an offset less than zero of the variable). They also cannot alias if the pointer may not point to the decl. */ - if (!ranges_overlap_p (MAX (0, offset1p), -1, offset2, max_size2)) + if (!ranges_overlap_p (MAX (0, offset1p), -1, offset2p, max_size2)) return false; if (!ptr_deref_may_alias_decl_p (ptr1, base2)) return false; @@ -804,10 +817,32 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, if ((!cfun || gimple_in_ssa_p (cfun)) && operand_equal_p (ptr1, ptr2, 0)) { + /* The offset embedded in MEM_REFs can be negative. Bias them + so that the resulting offset adjustment is positive. */ if (TREE_CODE (base1) == MEM_REF) - offset1 += mem_ref_offset (base1).low * BITS_PER_UNIT; + { + double_int moff = mem_ref_offset (base1); + moff = double_int_lshift (moff, + BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT, true); + if (double_int_negative_p (moff)) + offset2 += double_int_neg (moff).low; + else + offset1 += moff.low; + } if (TREE_CODE (base2) == MEM_REF) - offset2 += mem_ref_offset (base2).low * BITS_PER_UNIT; + { + double_int moff = mem_ref_offset (base2); + moff = double_int_lshift (moff, + BITS_PER_UNIT == 8 + ? 3 : exact_log2 (BITS_PER_UNIT), + HOST_BITS_PER_DOUBLE_INT, true); + if (double_int_negative_p (moff)) + offset1 += double_int_neg (moff).low; + else + offset2 += moff.low; + } return ranges_overlap_p (offset1, max_size1, offset2, max_size2); } if (!ptr_derefs_may_alias_p (ptr1, ptr2)) -- cgit v1.2.1 From 2512209b236017dc6514906a6f6cf624a490d680 Mon Sep 17 00:00:00 2001 From: aesok Date: Thu, 15 Jul 2010 18:47:23 +0000 Subject: * tree.h (enum tree_index): Add TI_INTEGER_THREE. (integer_three_node): Add. * tree.c (build_common_tree_nodes_2): Use integer_type_node insead of NULL_TREE in build_int_cst calls. Initialize the integer_three_node. * builtins.c (expand_builtin_prefetch): Use common tree nodes instead of call build_int_cst. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Ditto. * tree-ssa-loop-ivopts.c (idx_find_step): Ditto. (find_interesting_uses_address): Ditto. * tree-ssa-alias.c (ao_ref_init_from_ptr_and_size): Ditto. * tree-eh.c (lower_eh_constructs_2): Ditto. * tree-vect-loop.c (get_initial_def_for_induction): Ditto. * c-typeck.c (really_start_incremental_init, push_init_level): Ditto. * expmed.c (expand_divmod): Ditto. * tree-mudflap.c (mx_register_decls): Ditto. * varasm.c (array_size_for_constructor): Ditto. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Ditto. * c-parser.c (c_parser_postfix_expression): Ditto. /cp * decl.c (integer_three_node): Remove. (cxx_init_decl_processing): Do not initialize the integer_three_node. * cp-tree.h (integer_three_node): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162230 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa-alias.c') diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index d73ff5965f0..a95d78caca1 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -517,7 +517,7 @@ ao_ref_init_from_ptr_and_size (ao_ref *ref, tree ptr, tree size) else { ref->base = build2 (MEM_REF, char_type_node, - ptr, build_int_cst (ptr_type_node, 0)); + ptr, null_pointer_node); ref->offset = 0; } if (size -- cgit v1.2.1