diff options
author | Martin Jambor <mjambor@suse.cz> | 2010-07-22 14:52:14 +0200 |
---|---|---|
committer | Martin Jambor <jamborm@gcc.gnu.org> | 2010-07-22 14:52:14 +0200 |
commit | 56a42add96f40b6dfd8002abfc3e55f5ccf40535 (patch) | |
tree | 581bacc8bf5168e1f158d9364381e035e348e867 /gcc/tree-sra.c | |
parent | 553fc5823088c7d0956b8f6aa9ee6e900a5e8e98 (diff) | |
download | gcc-56a42add96f40b6dfd8002abfc3e55f5ccf40535.zip gcc-56a42add96f40b6dfd8002abfc3e55f5ccf40535.tar.gz gcc-56a42add96f40b6dfd8002abfc3e55f5ccf40535.tar.bz2 |
re PR tree-optimization/44891 (non-trivial conversion ICE from early SRA)
2010-07-22 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/44891
* tree-sra.c: Include gimple-pretty-print.h.
(replace_uses_with_default_def_ssa_name): Renamed to
get_repl_default_def_ssa_name, return the new SSA name instead of
replacing the old one.
(sra_modify_assign): Dump a message when removing a load, if the LHS
is an SSA_NAME, do not do any propagation, just set the RHS to a
default definition SSA NAME, type convert if necessary.
* Makefile.in (tree-sra.o): Add gimple-pretty-print.h to dependencies.
* testsuite/gcc.c-torture/compile/pr44891.c: New test.
From-SVN: r162413
Diffstat (limited to 'gcc/tree-sra.c')
-rw-r--r-- | gcc/tree-sra.c | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 9fd6d2c..c051dd4 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -90,6 +90,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "dbgcnt.h" #include "tree-inline.h" +#include "gimple-pretty-print.h" /* Enumeration of all aggregate reductions we can do. */ enum sra_mode { SRA_MODE_EARLY_IPA, /* early call regularization */ @@ -2542,12 +2543,12 @@ sra_modify_constructor_assign (gimple *stmt, gimple_stmt_iterator *gsi) } } -/* Create a new suitable default definition SSA_NAME and replace all uses of - SSA with it, RACC is access describing the uninitialized part of an - aggregate that is being loaded. */ +/* Create and return a new suitable default definition SSA_NAME for RACC which + is an access describing an uninitialized part of an aggregate that is being + loaded. */ -static void -replace_uses_with_default_def_ssa_name (tree ssa, struct access *racc) +static tree +get_repl_default_def_ssa_name (struct access *racc) { tree repl, decl; @@ -2560,7 +2561,7 @@ replace_uses_with_default_def_ssa_name (tree ssa, struct access *racc) set_default_def (decl, repl); } - replace_uses_by (ssa, repl); + return repl; } /* Examine both sides of the assignment statement pointed to by STMT, replace @@ -2737,18 +2738,33 @@ sra_modify_assign (gimple *stmt, gimple_stmt_iterator *gsi) { if (!racc->grp_to_be_replaced && !racc->grp_unscalarized_data) { - if (racc->first_child) - generate_subtree_copies (racc->first_child, lhs, - racc->offset, 0, 0, gsi, - false, false); - gcc_assert (*stmt == gsi_stmt (*gsi)); - if (TREE_CODE (lhs) == SSA_NAME) - replace_uses_with_default_def_ssa_name (lhs, racc); + if (dump_file) + { + fprintf (dump_file, "Removing load: "); + print_gimple_stmt (dump_file, *stmt, 0, 0); + } - unlink_stmt_vdef (*stmt); - gsi_remove (gsi, true); - sra_stats.deleted++; - return SRA_AM_REMOVED; + if (TREE_CODE (lhs) == SSA_NAME) + { + rhs = get_repl_default_def_ssa_name (racc); + if (!useless_type_conversion_p (TREE_TYPE (lhs), + TREE_TYPE (rhs))) + rhs = fold_build1_loc (loc, VIEW_CONVERT_EXPR, + TREE_TYPE (lhs), rhs); + } + else + { + if (racc->first_child) + generate_subtree_copies (racc->first_child, lhs, + racc->offset, 0, 0, gsi, + false, false); + + gcc_assert (*stmt == gsi_stmt (*gsi)); + unlink_stmt_vdef (*stmt); + gsi_remove (gsi, true); + sra_stats.deleted++; + return SRA_AM_REMOVED; + } } else if (racc->first_child) generate_subtree_copies (racc->first_child, lhs, |