diff options
author | Richard Biener <rguenther@suse.de> | 2014-05-07 14:19:14 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-05-07 14:19:14 +0000 |
commit | 50f0aa20742add8e1a59154ce76f45c157142fe3 (patch) | |
tree | a056046546fd39e638f07831fd0af58c4f918b06 /gcc/tree-ssa-sccvn.c | |
parent | 2588652e1742e1cf473917d59505632b9ce47ffa (diff) | |
download | gcc-50f0aa20742add8e1a59154ce76f45c157142fe3.zip gcc-50f0aa20742add8e1a59154ce76f45c157142fe3.tar.gz gcc-50f0aa20742add8e1a59154ce76f45c157142fe3.tar.bz2 |
re PR tree-optimization/61034 (Optimizing takes too many passes)
2014-05-07 Richard Biener <rguenther@suse.de>
PR tree-optimization/61034
* tree-ssa-alias.c (call_may_clobber_ref_p_1): Export.
(maybe_skip_until): Use translate to take into account
lattices when trying to do disambiguations.
(get_continuation_for_phi_1): Likewise.
(get_continuation_for_phi): Adjust for added translate
arguments.
(walk_non_aliased_vuses): Likewise.
* tree-ssa-alias.h (get_continuation_for_phi): Adjust
prototype.
(walk_non_aliased_vuses): Likewise.
(call_may_clobber_ref_p_1): Declare.
* tree-ssa-sccvn.c (vn_reference_lookup_3): Also
disambiguate against calls. Stop early if we are
only supposed to disambiguate.
* tree-ssa-pre.c (translate_vuse_through_block): Adjust.
* g++.dg/tree-ssa/pr61034.C: New testcase.
From-SVN: r210160
Diffstat (limited to 'gcc/tree-ssa-sccvn.c')
-rw-r--r-- | gcc/tree-ssa-sccvn.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/gcc/tree-ssa-sccvn.c b/gcc/tree-ssa-sccvn.c index 585fd85..05a5fe8 100644 --- a/gcc/tree-ssa-sccvn.c +++ b/gcc/tree-ssa-sccvn.c @@ -1542,7 +1542,8 @@ vn_reference_lookup_or_insert_for_pieces (tree vuse, of VUSE. */ static void * -vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_) +vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_, + bool disambiguate_only) { vn_reference_t vr = (vn_reference_t)vr_; gimple def_stmt = SSA_NAME_DEF_STMT (vuse); @@ -1580,6 +1581,39 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *vr_) lhs_ref_ok = true; } } + else if (gimple_call_builtin_p (def_stmt, BUILT_IN_NORMAL) + && gimple_call_num_args (def_stmt) <= 4) + { + /* For builtin calls valueize its arguments and call the + alias oracle again. Valueization may improve points-to + info of pointers and constify size and position arguments. + Originally this was motivated by PR61034 which has + conditional calls to free falsely clobbering ref because + of imprecise points-to info of the argument. */ + tree oldargs[4]; + bool valueized_anything; + for (unsigned i = 0; i < gimple_call_num_args (def_stmt); ++i) + { + oldargs[i] = gimple_call_arg (def_stmt, i); + if (TREE_CODE (oldargs[i]) == SSA_NAME + && VN_INFO (oldargs[i])->valnum != oldargs[i]) + { + gimple_call_set_arg (def_stmt, i, VN_INFO (oldargs[i])->valnum); + valueized_anything = true; + } + } + if (valueized_anything) + { + bool res = call_may_clobber_ref_p_1 (def_stmt, ref); + for (unsigned i = 0; i < gimple_call_num_args (def_stmt); ++i) + gimple_call_set_arg (def_stmt, i, oldargs[i]); + if (!res) + return NULL; + } + } + + if (disambiguate_only) + return (void *)-1; base = ao_ref_base (ref); offset = ref->offset; |