From: Mark Mitchell Date: Sat, 9 Jun 2001 23:08:05 +0000 (+0000) Subject: expr.c (expand_expr, [...]): Do not replace an array element with the known initializ... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e69decfd36cabe29f106ff1c277706ac621e690f;p=gcc.git expr.c (expand_expr, [...]): Do not replace an array element with the known initializing value if... * expr.c (expand_expr, case ARRAY_REF): Do not replace an array element with the known initializing value if it has side-effects. * toplev.c (rest_of_compilation): Remove dead code before purge_addressof. From-SVN: r43120 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b21874bd148..3c0d4a524a2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2001-06-09 Mark Mitchell + + * expr.c (expand_expr, case ARRAY_REF): Do not replace + an array element with the known initializing value if it has + side-effects. + + * toplev.c (rest_of_compilation): Remove dead code before + purge_addressof. + 2001-06-09 Neil Booth * cppinit.c (print_help): Document -fpreprocessed. diff --git a/gcc/expr.c b/gcc/expr.c index 732b1108ddf..a7b0ff4ff12 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -6891,7 +6891,7 @@ expand_expr (exp, target, tmode, modifier) elem = TREE_CHAIN (elem)) ; - if (elem) + if (elem && !TREE_SIDE_EFFECTS (elem)) return expand_expr (fold (TREE_VALUE (elem)), target, tmode, ro_modifier); } diff --git a/gcc/toplev.c b/gcc/toplev.c index 0e197cc2581..2b75aa20a58 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -3031,6 +3031,16 @@ rest_of_compilation (decl) timevar_pop (TV_JUMP); } + /* It's important to remove dead code before we call + purge_addressof. Sometimes, the only ADDRESSOFs for a REG + will be dead, and if we don't get rid of them, we will end up + committing ourselves to dumping the REG to the stack + unnecessarily. */ + find_basic_blocks (insns, max_reg_num (), rtl_dump_file); + cleanup_cfg (); + life_analysis (insns, rtl_dump_file, + PROP_SCAN_DEAD_CODE | PROP_KILL_DEAD_CODE); + /* The second pass of jump optimization is likely to have removed a bunch more instructions. */ renumber_insns (rtl_dump_file);