From 6278c3db6b4eb6f38ccd27c1227452ad9915db28 Mon Sep 17 00:00:00 2001 From: Andrew Senkevich Date: Fri, 27 Feb 2015 20:35:05 +0300 Subject: [4.9] Additional SLM tuning. Backport from trunk. 2014-11-24 Richard Biener PR tree-optimization/55334 * function.h (struct function): Add last_clique member. * tree-inline.c (remap_dependence_clique): New function. (remap_gimple_op_r): Remap dependence cliques in MEM_REFs. (copy_tree_body_r): Likewise. (copy_cfg_body): Free dependence map. (copy_gimple_seq_and_replace_locals): Likewise. * tree-pretty-print.c (dump_generic_node): Dump dependence info. * tree-ssa-alias.c (refs_may_alias_p_1): Use dependence info to answer alias query. * tree-ssa-structalias.c: Include tree-phinodes.h, ssa-iterators.h, tree-pretty-print.h and gimple-walk.h. (struct variable_info): Add is_restrict_var flag and ruid member. (new_var_info): Initialize is_restrict_var. (make_constraint_from_restrict): Likewise. (create_variable_info_for): Exclude restricts from global vars from new handling. (intra_create_variable_infos): But not those from parameters. (visit_loadstore): New function. (maybe_set_dependence_info): Likewise. (compute_dependence_clique): Likewise. (compute_may_aliases): Call compute_dependence_clique. * tree-data-ref.c (dr_analyze_indices): Copy dependence info to fake MEM_REF. (dr_may_alias_p): Use recorded dependence info to answer alias query. * tree-core.h (struct tree_base): Add clique, base struct in union. * tree.h (MR_DEPENDENCE_CLIQUE): New macro. (MR_DEPENDENCE_BASE): Likewise. * tree-inline.h (dependence_hasher): New hash-map kind. (struct copy_body_data): Add dependence_map pointer. * tree-streamer-in.c (unpack_value_fields): Stream dependence info. * tree-streamer-out.c (streamer_pack_tree_bitfields): Likewise. * gcc.dg/tree-ssa/restrict-5.c: New testcase. Change-Id: I45c8d5eac758aea881a884c131f627cc916cbaf3 Signed-off-by: Andrew Senkevich --- gcc-4.9/gcc/tree-inline.c | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'gcc-4.9/gcc/tree-inline.c') diff --git a/gcc-4.9/gcc/tree-inline.c b/gcc-4.9/gcc/tree-inline.c index beb65f0b1..624eca1c4 100644 --- a/gcc-4.9/gcc/tree-inline.c +++ b/gcc-4.9/gcc/tree-inline.c @@ -787,6 +787,24 @@ is_parm (tree decl) return (TREE_CODE (decl) == PARM_DECL); } +/* Remap the dependence CLIQUE from the source to the destination function + as specified in ID. */ + +static unsigned short +remap_dependence_clique (copy_body_data *id, unsigned short clique) +{ + if (clique == 0) + return 0; + if (!id->dependence_map) + id->dependence_map = pointer_map_create (); + void **newc = pointer_map_contains (id->dependence_map, + (void *)(uintptr_t)clique); + if (!newc) + newc = pointer_map_insert (id->dependence_map, + (void *)(uintptr_t)++cfun->last_clique); + return (uintptr_t)*newc; +} + /* Remap the GIMPLE operand pointed to by *TP. DATA is really a 'struct walk_stmt_info *'. DATA->INFO is a 'copy_body_data *'. WALK_SUBTREES is used to indicate walk_gimple_op whether to keep @@ -886,6 +904,12 @@ remap_gimple_op_r (tree *tp, int *walk_subtrees, void *data) TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old); TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old); + if (MR_DEPENDENCE_CLIQUE (old) != 0) + { + MR_DEPENDENCE_CLIQUE (*tp) + = remap_dependence_clique (id, MR_DEPENDENCE_CLIQUE (old)); + MR_DEPENDENCE_BASE (*tp) = MR_DEPENDENCE_BASE (old); + } /* We cannot propagate the TREE_THIS_NOTRAP flag if we have remapped a parameter as the property might be valid only for the parameter itself. */ @@ -1139,6 +1163,12 @@ copy_tree_body_r (tree *tp, int *walk_subtrees, void *data) TREE_THIS_VOLATILE (*tp) = TREE_THIS_VOLATILE (old); TREE_SIDE_EFFECTS (*tp) = TREE_SIDE_EFFECTS (old); TREE_NO_WARNING (*tp) = TREE_NO_WARNING (old); + if (MR_DEPENDENCE_CLIQUE (old) != 0) + { + MR_DEPENDENCE_CLIQUE (*tp) + = remap_dependence_clique (id, MR_DEPENDENCE_CLIQUE (old)); + MR_DEPENDENCE_BASE (*tp) = MR_DEPENDENCE_BASE (old); + } /* We cannot propagate the TREE_THIS_NOTRAP flag if we have remapped a parameter as the property might be valid only for the parameter itself. */ @@ -2599,6 +2629,11 @@ copy_cfg_body (copy_body_data * id, gcov_type count, int frequency_scale, pointer_map_destroy (id->eh_map); id->eh_map = NULL; } + if (id->dependence_map) + { + pointer_map_destroy (id->dependence_map); + id->dependence_map = NULL; + } return new_fndecl; } @@ -4954,6 +4989,11 @@ copy_gimple_seq_and_replace_locals (gimple_seq seq) pointer_map_destroy (id.decl_map); if (id.debug_map) pointer_map_destroy (id.debug_map); + if (id.dependence_map) + { + pointer_map_destroy (id.dependence_map); + id.dependence_map = NULL; + } return copy; } -- cgit v1.2.3