From 540f6bda9926d60d7691fc4a21fe78338b450952 Mon Sep 17 00:00:00 2001 From: Richard Guenther Date: Wed, 28 May 2008 13:54:05 +0000 Subject: [PATCH] re PR tree-optimization/36291 (GCC is slow and memory-hungry building sipQtGuipart.cpp) 2008-05-28 Richard Guenther PR tree-optimization/36291 * tree-flow. h (struct gimple_df): Remove var_anns member. * tree-flow-inline.h (gimple_var_anns): Remove. (var_ann): Simplify. * tree-dfa.c (create_var_ann): Simplify. (remove_referenced_var): Clear alias info from var_anns of globals. * tree-ssa.c (init_tree_ssa): Do not allocate var_anns. (delete_tree_ssa): Clear alias info from var_anns of globals. Do not free var_anns. (var_ann_eq): Remove. (var_ann_hash): Likewise. From-SVN: r136095 --- gcc/ChangeLog | 14 ++++++++++++++ gcc/tree-dfa.c | 39 ++++++++++++++++----------------------- gcc/tree-flow-inline.h | 27 +++------------------------ gcc/tree-flow.h | 4 ---- gcc/tree-ssa.c | 31 ++++++++----------------------- 5 files changed, 41 insertions(+), 74 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6af46e5e833..20d5b105400 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,17 @@ +2008-05-28 Richard Guenther + + PR tree-optimization/36291 + * tree-flow. h (struct gimple_df): Remove var_anns member. + * tree-flow-inline.h (gimple_var_anns): Remove. + (var_ann): Simplify. + * tree-dfa.c (create_var_ann): Simplify. + (remove_referenced_var): Clear alias info from var_anns of globals. + * tree-ssa.c (init_tree_ssa): Do not allocate var_anns. + (delete_tree_ssa): Clear alias info from var_anns of globals. + Do not free var_anns. + (var_ann_eq): Remove. + (var_ann_hash): Likewise. + 2008-05-28 Mark Shinwell * config/mips/mips.c (mips_cpu_info_table): Add loongson2e diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c index 7e4bb7681b7..af167492de6 100644 --- a/gcc/tree-dfa.c +++ b/gcc/tree-dfa.c @@ -142,33 +142,14 @@ var_ann_t create_var_ann (tree t) { var_ann_t ann; - struct static_var_ann_d *sann = NULL; gcc_assert (t); gcc_assert (DECL_P (t)); gcc_assert (!t->base.ann || t->base.ann->common.type == VAR_ANN); - if (!MTAG_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t))) - { - sann = GGC_CNEW (struct static_var_ann_d); - ann = &sann->ann; - } - else - ann = GGC_CNEW (struct var_ann_d); - + ann = GGC_CNEW (struct var_ann_d); ann->common.type = VAR_ANN; - - if (!MTAG_P (t) && (TREE_STATIC (t) || DECL_EXTERNAL (t))) - { - void **slot; - sann->uid = DECL_UID (t); - slot = htab_find_slot_with_hash (gimple_var_anns (cfun), - t, DECL_UID (t), INSERT); - gcc_assert (!*slot); - *slot = sann; - } - else - t->base.ann = (tree_ann_t) ann; + t->base.ann = (tree_ann_t) ann; return ann; } @@ -765,8 +746,20 @@ remove_referenced_var (tree var) clear_call_clobbered (var); if ((v_ann = var_ann (var))) - ggc_free (v_ann); - var->base.ann = NULL; + { + /* Preserve var_anns of globals, but clear their alias info. */ + if (MTAG_P (var) + || (!TREE_STATIC (var) && !DECL_EXTERNAL (var))) + { + ggc_free (v_ann); + var->base.ann = NULL; + } + else + { + v_ann->mpt = NULL_TREE; + v_ann->symbol_mem_tag = NULL_TREE; + } + } gcc_assert (DECL_P (var)); in.uid = uid; loc = htab_find_slot_with_hash (gimple_referenced_vars (cfun), &in, uid, diff --git a/gcc/tree-flow-inline.h b/gcc/tree-flow-inline.h index a41ee9ac2eb..95ddfb5b130 100644 --- a/gcc/tree-flow-inline.h +++ b/gcc/tree-flow-inline.h @@ -91,14 +91,6 @@ gimple_nonlocal_all (const struct function *fun) return fun->gimple_df->nonlocal_all; } -/* Hashtable of variables annotations. Used for static variables only; - local variables have direct pointer in the tree node. */ -static inline htab_t -gimple_var_anns (const struct function *fun) -{ - return fun->gimple_df->var_anns; -} - /* Initialize the hashtable iterator HTI to point to hashtable TABLE */ static inline void * @@ -192,22 +184,9 @@ var_ann (const_tree t) { var_ann_t ann; - if (!MTAG_P (t) - && (TREE_STATIC (t) || DECL_EXTERNAL (t))) - { - struct static_var_ann_d *sann - = ((struct static_var_ann_d *) - htab_find_with_hash (gimple_var_anns (cfun), t, DECL_UID (t))); - if (!sann) - return NULL; - ann = &sann->ann; - } - else - { - if (!t->base.ann) - return NULL; - ann = (var_ann_t) t->base.ann; - } + if (!t->base.ann) + return NULL; + ann = (var_ann_t) t->base.ann; gcc_assert (ann->common.type == VAR_ANN); diff --git a/gcc/tree-flow.h b/gcc/tree-flow.h index bd1f87ab396..8bc6cc8a0ca 100644 --- a/gcc/tree-flow.h +++ b/gcc/tree-flow.h @@ -188,10 +188,6 @@ struct gimple_df GTY(()) struct ssa_operands ssa_operands; - /* Hashtable of variables annotations. Used for static variables only; - local variables have direct pointer in the tree node. */ - htab_t GTY((param_is (struct static_var_ann_d))) var_anns; - /* Memory reference statistics collected during alias analysis. This information is used to drive the memory partitioning heuristics in compute_memory_partitions. */ diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 150074f7c23..1c01d71bf6e 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -904,24 +904,6 @@ uid_decl_map_hash (const void *item) return ((const_tree)item)->decl_minimal.uid; } -/* Return true if the uid in both int tree maps are equal. */ - -static int -var_ann_eq (const void *va, const void *vb) -{ - const struct static_var_ann_d *a = (const struct static_var_ann_d *) va; - const_tree const b = (const_tree) vb; - return (a->uid == DECL_UID (b)); -} - -/* Hash a UID in a int_tree_map. */ - -static unsigned int -var_ann_hash (const void *item) -{ - return ((const struct static_var_ann_d *)item)->uid; -} - /* Return true if the DECL_UID in both trees are equal. */ static int @@ -951,8 +933,6 @@ init_tree_ssa (struct function *fn) uid_decl_map_eq, NULL); fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, uid_ssaname_map_eq, NULL); - fn->gimple_df->var_anns = htab_create_ggc (20, var_ann_hash, - var_ann_eq, NULL); fn->gimple_df->call_clobbered_vars = BITMAP_GGC_ALLOC (); fn->gimple_df->addressable_vars = BITMAP_GGC_ALLOC (); init_ssanames (fn, 0); @@ -998,9 +978,16 @@ delete_tree_ssa (void) set_phi_nodes (bb, NULL); } - /* Remove annotations from every referenced variable. */ + /* Remove annotations from every referenced local variable. */ FOR_EACH_REFERENCED_VAR (var, rvi) { + if (!MTAG_P (var) + && (TREE_STATIC (var) || DECL_EXTERNAL (var))) + { + var_ann (var)->mpt = NULL_TREE; + var_ann (var)->symbol_mem_tag = NULL_TREE; + continue; + } if (var->base.ann) ggc_free (var->base.ann); var->base.ann = NULL; @@ -1018,8 +1005,6 @@ delete_tree_ssa (void) htab_delete (cfun->gimple_df->default_defs); cfun->gimple_df->default_defs = NULL; - htab_delete (cfun->gimple_df->var_anns); - cfun->gimple_df->var_anns = NULL; cfun->gimple_df->call_clobbered_vars = NULL; cfun->gimple_df->addressable_vars = NULL; cfun->gimple_df->modified_noreturn_calls = NULL; -- 2.30.2