aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2009-05-22 20:41:31 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2009-05-22 20:41:31 +0000
commit4d7a65ea616c964b6797710e6bad610598d55df6 (patch)
tree591b8d105b3bc5fac1ff8aabd16a58458d55aece /gcc/tree-ssa-alias.c
parent83a6ac60c6100cfa605da437391c1fd8b327055a (diff)
downloadgcc-4d7a65ea616c964b6797710e6bad610598d55df6.zip
gcc-4d7a65ea616c964b6797710e6bad610598d55df6.tar.gz
gcc-4d7a65ea616c964b6797710e6bad610598d55df6.tar.bz2
re PR tree-optimization/38964 (TBAA side-effects of C++ new still missing)
2009-05-22 Richard Guenther <rguenther@suse.de> PR middle-end/38964 * alias.c (write_dependence_p): Do not use TBAA for answering anti-dependence or output-dependence. * tree-ssa-structalias.c (set_uids_in_ptset): Remove TBAA pruning code. (emit_pointer_definition): Remove. (emit_alias_warning): Likewise. (find_what_var_points_to): Remove TBAA pruning code. (find_what_p_points_to): Likewise. Do not warn about strict-aliasing violations. (compute_points_to_sets): Remove code computing the set of dereferenced pointers. * tree-data-ref.c (dr_may_alias_p): Properly use the split oracle for querying anti and output dependencies. * tree-ssa-alias.c (refs_may_alias_p_1): Add argument specifying if TBAA may be applied. (refs_anti_dependent_p): New function. (refs_output_dependent_p): Likewise. * tree-ssa-alias.h (refs_anti_dependent_p): Declare. (refs_output_dependent_p): Likewise. * doc/tree-ssa.texi (Memory model): New section. testsuite/ * g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C: XFAIL. * gcc.dg/Wstrict-aliasing-converted-assigned.c: Likewise. * gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c: Likewise. * doc/c-tree.texi (CHANGE_DYNAMIC_TYPE_EXPR): Remove. * doc/gimple.texi (GIMPLE_CHANGE_DYNAMIC_TYPE): Remove. * cfgexpand.c (expand_gimple_basic_block): Do not handle GIMPLE_CHANGE_DYNAMIC_TYPE or CHANGE_DYNAMIC_TYPE_EXPR. * expr.c (expand_expr_real_1): Likewise. * gimple-low.c (lower_stmt): Likewise. * gimple-pretty-print.c (dump_gimple_stmt): Likewise. (dump_gimple_cdt): Remove. * gimple.c (gss_for_code): Do not handle GIMPLE_CHANGE_DYNAMIC_TYPE. (gimple_size): Likewise. (walk_gimple_op): Likewise. (is_gimple_stmt): Likewise. (walk_stmt_load_store_addr_ops): Likewise. (gimple_build_cdt): Remove. * gimple.def (GIMPLE_CHANGE_DYNAMIC_TYPE): Remove. * gimple.h (gimple_cdt_new_type): Remove. (gimple_cdt_new_type_ptr): Likewise. (gimple_cdt_set_new_type): Likewise. (gimple_cdt_location): Likewise. (gimple_cdt_location_ptr): Likewise. (gimple_cdt_set_location): Likewise. * gimplify.c (gimplify_expr): Do not handle CHANGE_DYNAMIC_TYPE_EXPR. * tree-cfg.c (remove_useless_stmts_1): Do not handle GIMPLE_CHANGE_DYNAMIC_TYPE. (verify_types_in_gimple_stmt): Likewise. * tree-inline.c (estimate_num_insns): Likewise. (expand_call_inline): Do not copy DECL_NO_TBAA_P. (copy_decl_to_var): Likewise. (copy_result_decl_to_var): Likewise. * tree-pretty-print.c (dump_generic_node): Do not handle CHANGE_DYNAMIC_TYPE_EXPR. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-ssa-structalias.c (struct variable_info): Remove no_tbaa_pruning member. (new_var_info): Do not set it based on DECL_NO_TBAA_P. (unify_nodes): Do not copy it. (find_func_aliases): Do not handle GIMPLE_CHANGE_DYNAMIC_TYPE. (dump_solution_for_var): Do not dump no_tbaa_pruning state. (set_uids_in_ptset): Do not check it. (find_what_var_points_to): Likewise. (compute_tbaa_pruning): Remove. (compute_points_to_sets): Do not call it. * tree.c (walk_tree_1): Do not handle CHANGE_DYNAMIC_TYPE_EXPR. * tree.def (CHANGE_DYNAMIC_TYPE_EXPR): Remove. * tree.h (CHANGE_DYNAMIC_TYPE_NEW_TYPE): Remove. (CHANGE_DYNAMIC_TYPE_LOCATION): Likewise. (DECL_NO_TBAA_P): Likewise. (struct tree_decl_common): Move no_tbaa_flag to unused flags section. * omp-low.c (copy_var_decl): Do not copy DECL_NO_TBAA_P. (expand_omp_atomic_pipeline): Do not set it. * print-tree.c (print_node): Do not dump it. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Remove redundant check. cp/ * init.c (avoid_placement_new_aliasing): Remove. (build_new_1): Do not call it. From-SVN: r147805
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c49
1 files changed, 38 insertions, 11 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 8982280..ef360ea 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -155,10 +155,13 @@ ptr_deref_may_alias_global_p (tree ptr)
if (!pi)
return true;
+ /* ??? This does not use TBAA to prune globals ptr may not access. */
return pt_solution_includes_global (&pi->pt);
}
-/* Return true if dereferencing PTR may alias DECL. */
+/* Return true if dereferencing PTR may alias DECL.
+ The caller is responsible for applying TBAA to see if PTR
+ may access DECL at all. */
static bool
ptr_deref_may_alias_decl_p (tree ptr, tree decl)
@@ -190,7 +193,9 @@ ptr_deref_may_alias_decl_p (tree ptr, tree decl)
return pt_solution_includes (&pi->pt, decl);
}
-/* Return true if dereferenced PTR1 and PTR2 may alias. */
+/* Return true if dereferenced PTR1 and PTR2 may alias.
+ The caller is responsible for applying TBAA to see if accesses
+ through PTR1 and PTR2 may conflict at all. */
static bool
ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
@@ -222,6 +227,8 @@ ptr_derefs_may_alias_p (tree ptr1, tree ptr2)
if (!pi1 || !pi2)
return true;
+ /* ??? 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);
}
@@ -653,13 +660,14 @@ indirect_refs_may_alias_p (tree ref1, tree ptr1,
/* Return true, if the two memory references REF1 and REF2 may alias. */
static bool
-refs_may_alias_p_1 (tree ref1, tree ref2)
+refs_may_alias_p_1 (tree ref1, tree 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;
gcc_assert ((SSA_VAR_P (ref1)
|| handled_component_p (ref1)
@@ -694,7 +702,8 @@ refs_may_alias_p_1 (tree ref1, tree ref2)
base2, offset2, max_size2);
/* First defer to TBAA if possible. */
- if (flag_strict_aliasing
+ if (tbaa_p
+ && flag_strict_aliasing
&& !alias_sets_conflict_p (get_alias_set (ref1), get_alias_set (ref2)))
return false;
@@ -708,21 +717,22 @@ refs_may_alias_p_1 (tree ref1, tree ref2)
/* 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, TREE_OPERAND (base2, 0),
- offset2, max_size2, -1,
+ offset2, max_size2, set,
ref1, base1,
- offset1, max_size1, -1);
+ offset1, max_size1, set);
else if (ind1_p && var2_p)
return indirect_ref_may_alias_decl_p (ref1, TREE_OPERAND (base1, 0),
- offset1, max_size1, -1,
+ offset1, max_size1, set,
ref2, base2,
- offset2, max_size2, -1);
+ offset2, max_size2, set);
else if (ind1_p && ind2_p)
return indirect_refs_may_alias_p (ref1, TREE_OPERAND (base1, 0),
- offset1, max_size1, -1,
+ offset1, max_size1, set,
ref2, TREE_OPERAND (base2, 0),
- offset2, max_size2, -1);
+ offset2, max_size2, set);
gcc_unreachable ();
}
@@ -730,7 +740,7 @@ refs_may_alias_p_1 (tree ref1, tree ref2)
bool
refs_may_alias_p (tree ref1, tree ref2)
{
- bool res = refs_may_alias_p_1 (ref1, ref2);
+ bool res = refs_may_alias_p_1 (ref1, ref2, true);
if (res)
++alias_stats.refs_may_alias_p_may_alias;
else
@@ -738,6 +748,23 @@ refs_may_alias_p (tree ref1, tree ref2)
return res;
}
+/* Returns true if there is a anti-dependence for the STORE that
+ executes after the LOAD. */
+
+bool
+refs_anti_dependent_p (tree load, tree store)
+{
+ return refs_may_alias_p_1 (load, store, false);
+}
+
+/* Returns true if there is a output dependence for the stores
+ STORE1 and STORE2. */
+
+bool
+refs_output_dependent_p (tree store1, tree store2)
+{
+ return refs_may_alias_p_1 (store1, store2, false);
+}
/* If the call CALL may use the memory reference REF return true,
otherwise return false. */