diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-10 08:29:29 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-08-10 08:29:29 +0000 |
commit | ec11736b57986660deef21d6375d2f23edf290d2 (patch) | |
tree | 997e1b096111bead6b6ecba118fde1adf2e1a6ff /gcc/tree-ssa-copyrename.c | |
parent | 6331b6fa2c9eca625aabcecf3a691577b3cca229 (diff) | |
download | gcc-ec11736b57986660deef21d6375d2f23edf290d2.tar.gz |
2012-08-10 Richard Guenther <rguenther@suse.de>
* tree.h (SSA_NAME_VAR): Return NULL_TREE if an IDENTIFIER_NODE
is recorded as var.
(SSA_NAME_IDENTIFIER): Return the IDENTIFIER_NODE of the SSA_NAME
or its SSA_NAME_VAR.
(SET_SSA_NAME_VAR_OR_IDENTIFIER): New setter.
* tree-ssanames.c (make_ssa_name_fn): Handle creating anonymous
SSA names by passing a type instead of a variable decl.
(release_ssa_name): Use SET_SSA_NAME_VAR_OR_IDENTIFIER.
(copy_ssa_name_fn): Handle anonymous SSA names.
(replace_ssa_name_symbol): Use SET_SSA_NAME_VAR_OR_IDENTIFIER.
* tree-flow-inline.h (make_temp_ssa_name): New inline function.
* tree-pretty-print.c (dump_generic_node): Use SSA_NAME_IDENTIFIER,
dump SSA names without a name as <anon>.
* cfgexpand.c (expand_used_vars): Assing anonymous SSA names we are
going to expand a decl.
(gimple_expand_cfg): Assign all SSA names of a partition the
decl we created for its leader.
* tree-ssa.c (target_for_debug_bind): Handle SSA_NAMEs.
(verify_ssa_name): Handle anonymous SSA names.
(verify_def): Likewise.
* tree-predcom.c (eliminate_temp_copies): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-live.c (var_map_base_init): Compute conflicts for
anonymous SSA names with the same type.
(mark_all_vars_used_1): Handle anonymous SSA names.
(verify_live_on_entry): Likewise.
* tree-ssa-coalesce.c (abnormal_corrupt): Remove.
(create_outofssa_var_map): Adjust with respect to conflicts we
compute for anonymous SSA names. Do not restrict abnormal
coalescing.
(coalesce_partitions): Do not restrict abnormal coalescing.
Assert we only ever coalesce variables we computed conflicts for.
* tree-ssa-ter.c (process_replaceable): Do not restrict TER
of anonymous names.
* expr.c (expand_expr_real_1): Handle anonymous SSA names
expanded from IVOPTs by creating a raw REG here.
* tree-cfg.c (replace_ssa_name): Handle anonymous SSA names.
(dump_function_to_file): Dump anonymous SSA names alongside
with their types in the variable list.
(verify_gimple_return): Guard use of SSA_NAME_VAR.
* tree-into-ssa.c (mark_for_renaming): Handle a NULL symbol.
(rewrite_into_ssa): Make SSA names anonymous.
* tree-ssa-structalias.c (alias_get_name): Rewrite.
* tree-ssa-uninit.c (ssa_undefined_value_p): Handle anonymous
SSA names.
(warn_uninitialized_phi): Likewise.
* tree-ssa-loop-ivopts.c (prepare_decl_rtl): Defer expanding
anonymous SSA names to the expander.
(determine_iv_cost): Anonymous SSA names are artificial.
* tree-ssa-loop-manip.c (tree_transform_and_unroll_loop):
Handle anonymous SSA names.
* lto-streamer-out.c (output_ssa_names): Stream SSA_NAME_VAR
or if NULL, the type of the SSA name.
* tree-inline.c (remap_ssa_name): Handle anonymous SSA names,
remap names as anonymous where appropriate.
(insert_init_stmt): Pass SSA names down to insert_init_debug_bind.
* tree-ssa-uncprop.c (uncprop_into_successor_phis): Adjust
according to what we create conflicts for in out-of-SSA
coalescing.
* tree-parloops.c (separate_decls_in_region_name): Handle
anonymous SSA names.
(add_field_for_name): Likewise.
* tree.c (get_name): Handle SSA names.
* tree-ssa-loop-im.c (gen_lsm_tmp_name): Defer to get_name for
SSA_NAMEs.
* tree-vect-loop-manip.c (adjust_debug_stmts): Use
virtual_operand_p.
* tree-sra.c (create_access_replacement): Give up generating
a DECL_DEBUG_EXPR for SSA names in the memory reference.
(replace_removed_params_ssa_names): Guard use of SSA_NAME_VAR.
* tree-complex.c (get_component_ssa_name): Handle anonymous
SSA names.
(set_component_ssa_name): Likewise.
* tree-ssa-sccvn.c (visit_reference_op_load): Likewise.
* tree-object-size.c (collect_object_sizes_for): Handle
uninitialized SSA names properly.
* ipa-inline-analysis.c (eliminated_by_inlining_prob): Guard use of
SSA_NAME_VAR.
* ipa-split.c (test_nonssa_use): Likewise.
(consider_split): Likewise.
(mark_nonssa_use): Likewise.
c-family/
* c-pretty-print.c (pp_c_expression): Handle anonymous SSA names.
cp/
* error.c (dump_expr): Likewise.
* g++.dg/plugin/selfassign.c: Adjust.
* gcc.dg/plugin/selfassign.c: Likewise.
* gcc.dg/strlenopt-11.c: Likewise.
* gcc.dg/strlenopt-13.c: Likewise.
* gcc.dg/no-strict-overflow-4.c: Likewise.
* gcc.dg/strict-overflow-4.c: Likewise.
* gcc.dg/tree-ssa/alias-11.c: Likewise.
* gcc.dg/tree-ssa/alias-6.c: Likewise.
* gcc.dg/tree-ssa/asm-3.c: Likewise.
* gcc.dg/tree-ssa/pr18908.c: Likewise.
* gcc.dg/tree-ssa/pr19431.c: Likewise.
* gcc.dg/tree-ssa/ssa-pre-21.c: Likewise.
* gcc.dg/tree-ssa/phi-opt-10.c: Likewise.
* gcc.dg/tree-ssa/phi-opt-7.c: Likewise.
* gcc.dg/tree-ssa/slsr-27.c: Likewise.
* gcc.dg/tree-ssa/slsr-28.c: Likewise.
* gcc.dg/tree-ssa/slsr-29.c: Likewise.
* gcc.dg/pr46309.c: Likewise.
* gcc.dg/tree-ssa/loop-5.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190284 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-copyrename.c')
-rw-r--r-- | gcc/tree-ssa-copyrename.c | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/gcc/tree-ssa-copyrename.c b/gcc/tree-ssa-copyrename.c index e02d7298031..82f8c64fe1c 100644 --- a/gcc/tree-ssa-copyrename.c +++ b/gcc/tree-ssa-copyrename.c @@ -143,11 +143,6 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) gcc_assert (p1 != NO_PARTITION); gcc_assert (p2 != NO_PARTITION); - rep1 = partition_to_var (map, p1); - rep2 = partition_to_var (map, p2); - root1 = SSA_NAME_VAR (rep1); - root2 = SSA_NAME_VAR (rep2); - if (p1 == p2) { if (debug) @@ -155,6 +150,13 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) return false; } + rep1 = partition_to_var (map, p1); + rep2 = partition_to_var (map, p2); + root1 = SSA_NAME_VAR (rep1); + root2 = SSA_NAME_VAR (rep2); + if (!root1 && !root2) + return false; + /* Don't coalesce if one of the variables occurs in an abnormal PHI. */ abnorm = (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep1) || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rep2)); @@ -175,22 +177,24 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) } /* Never attempt to coalesce 2 different parameters. */ - if (TREE_CODE (root1) == PARM_DECL && TREE_CODE (root2) == PARM_DECL) + if ((root1 && TREE_CODE (root1) == PARM_DECL) + && (root2 && TREE_CODE (root2) == PARM_DECL)) { if (debug) fprintf (debug, " : 2 different PARM_DECLS. No coalesce.\n"); return false; } - if ((TREE_CODE (root1) == RESULT_DECL) != (TREE_CODE (root2) == RESULT_DECL)) + if ((root1 && TREE_CODE (root1) == RESULT_DECL) + != (root2 && TREE_CODE (root2) == RESULT_DECL)) { if (debug) fprintf (debug, " : One root a RESULT_DECL. No coalesce.\n"); return false; } - ign1 = TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1); - ign2 = TREE_CODE (root2) == VAR_DECL && DECL_IGNORED_P (root2); + ign1 = !root1 || (TREE_CODE (root1) == VAR_DECL && DECL_IGNORED_P (root1)); + ign2 = !root2 || (TREE_CODE (root2) == VAR_DECL && DECL_IGNORED_P (root2)); /* Refrain from coalescing user variables, if requested. */ if (!ign1 && !ign2) @@ -211,9 +215,9 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) /* If both values have default defs, we can't coalesce. If only one has a tag, make sure that variable is the new root partition. */ - if (ssa_default_def (cfun, root1)) + if (root1 && ssa_default_def (cfun, root1)) { - if (ssa_default_def (cfun, root2)) + if (root2 && ssa_default_def (cfun, root2)) { if (debug) fprintf (debug, " : 2 default defs. No coalesce.\n"); @@ -225,18 +229,28 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) ign1 = false; } } - else if (ssa_default_def (cfun, root2)) + else if (root2 && ssa_default_def (cfun, root2)) { ign1 = true; ign2 = false; } + /* Do not coalesce if we cannot assign a symbol to the partition. */ + if (!(!ign2 && root2) + && !(!ign1 && root1)) + { + if (debug) + fprintf (debug, " : Choosen variable has no root. No coalesce.\n"); + return false; + } + /* Don't coalesce if the new chosen root variable would be read-only. If both ign1 && ign2, then the root var of the larger partition wins, so reject in that case if any of the root vars is TREE_READONLY. Otherwise reject only if the root var, on which replace_ssa_name_symbol will be called below, is readonly. */ - if ((TREE_READONLY (root1) && ign2) || (TREE_READONLY (root2) && ign1)) + if (((root1 && TREE_READONLY (root1)) && ign2) + || ((root2 && TREE_READONLY (root2)) && ign1)) { if (debug) fprintf (debug, " : Readonly variable. No coalesce.\n"); @@ -244,12 +258,12 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) } /* Don't coalesce if the two variables aren't type compatible . */ - if (!types_compatible_p (TREE_TYPE (root1), TREE_TYPE (root2)) + if (!types_compatible_p (TREE_TYPE (var1), TREE_TYPE (var2)) /* There is a disconnect between the middle-end type-system and VRP, avoid coalescing enum types with different bounds. */ - || ((TREE_CODE (TREE_TYPE (root1)) == ENUMERAL_TYPE - || TREE_CODE (TREE_TYPE (root2)) == ENUMERAL_TYPE) - && TREE_TYPE (root1) != TREE_TYPE (root2))) + || ((TREE_CODE (TREE_TYPE (var1)) == ENUMERAL_TYPE + || TREE_CODE (TREE_TYPE (var2)) == ENUMERAL_TYPE) + && TREE_TYPE (var1) != TREE_TYPE (var2))) { if (debug) fprintf (debug, " : Incompatible types. No coalesce.\n"); @@ -261,10 +275,12 @@ copy_rename_partition_coalesce (var_map map, tree var1, tree var2, FILE *debug) /* Set the root variable of the partition to the better choice, if there is one. */ - if (!ign2) + if (!ign2 && root2) replace_ssa_name_symbol (partition_to_var (map, p3), root2); - else if (!ign1) + else if (!ign1 && root1) replace_ssa_name_symbol (partition_to_var (map, p3), root1); + else + gcc_unreachable (); if (debug) { |