This is it. Yay. Apart from return variable handling the inliner is clean (even that we could clean up, but we're currently re-writing virtual SSA form from the scratch anyway, so the benefit would be minor). This patch saves us one update_stmt call per statement (and update_stmt is not cheap!).
Bootstrapped on x86_64-unknown-linux-gnu, testing nearly finished (and fingers crossing ...). Richard. 2012-05-16 Richard Guenther <rguent...@suse.de> * tree-flow.h (mark_symbols_for_renaming): Remove. * tree-dfa.c (mark_symbols_for_renaming): Likewise. * tree-inline.c (copy_edges_for_bb): Do not mark symbols for renaming. (copy_debug_stmt): Likewise. (expand_call_inline): Likewise. (declare_return_variable): Mark the return variable for renaming if necessary. Index: gcc/tree-flow.h =================================================================== *** gcc/tree-flow.h (revision 187593) --- gcc/tree-flow.h (working copy) *************** extern void dump_variable (FILE *, tree) *** 493,499 **** extern void debug_variable (tree); extern bool add_referenced_var (tree); extern void remove_referenced_var (tree); - extern void mark_symbols_for_renaming (gimple); extern tree make_rename_temp (tree, const char *); extern void set_default_def (tree, tree); extern tree gimple_default_def (struct function *, tree); --- 493,498 ---- Index: gcc/tree-dfa.c =================================================================== *** gcc/tree-dfa.c (revision 187593) --- gcc/tree-dfa.c (working copy) *************** remove_referenced_var (tree var) *** 624,646 **** } - /* Mark all the naked symbols in STMT for SSA renaming. */ - - void - mark_symbols_for_renaming (gimple stmt) - { - tree op; - ssa_op_iter iter; - - update_stmt (stmt); - - /* Mark all the operands for renaming. */ - FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_ALL_OPERANDS) - if (DECL_P (op)) - mark_sym_for_renaming (op); - } - - /* If EXP is a handled component reference for a structure, return the base variable. The access range is delimited by bit positions *POFFSET and *POFFSET + *PMAX_SIZE. The access size is *PSIZE bits. If either --- 616,621 ---- Index: gcc/tree-inline.c =================================================================== *** gcc/tree-inline.c (revision 187593) --- gcc/tree-inline.c (working copy) *************** copy_edges_for_bb (basic_block bb, gcov_ *** 1921,1931 **** copy_stmt = gsi_stmt (si); if (!is_gimple_debug (copy_stmt)) ! { ! update_stmt (copy_stmt); ! if (gimple_in_ssa_p (cfun)) ! mark_symbols_for_renaming (copy_stmt); ! } /* Do this before the possible split_block. */ gsi_next (&si); --- 1921,1927 ---- copy_stmt = gsi_stmt (si); if (!is_gimple_debug (copy_stmt)) ! update_stmt (copy_stmt); /* Do this before the possible split_block. */ gsi_next (&si); *************** copy_debug_stmt (gimple stmt, copy_body_ *** 2397,2404 **** processing_debug_stmt = 0; update_stmt (stmt); - if (gimple_in_ssa_p (cfun)) - mark_symbols_for_renaming (stmt); } /* Process deferred debug stmts. In order to give values better odds --- 2393,2398 ---- *************** declare_return_variable (copy_body_data *** 2961,2966 **** --- 2955,2965 ---- TREE_ADDRESSABLE (var) = 1; var = build_fold_addr_expr (var); } + else if (gimple_in_ssa_p (cfun) + && is_gimple_reg (var)) + /* ??? Re-org id->retval and its special handling so that we can + record an SSA name directly and not need to invoke the SSA renamer. */ + mark_sym_for_renaming (var); done: /* Register the VAR_DECL as the equivalent for the RESULT_DECL; that *************** expand_call_inline (basic_block bb, gimp *** 4032,4039 **** gimple old_stmt = stmt; stmt = gimple_build_assign (gimple_call_lhs (stmt), use_retvar); gsi_replace (&stmt_gsi, stmt, false); - if (gimple_in_ssa_p (cfun)) - mark_symbols_for_renaming (stmt); maybe_clean_or_replace_eh_stmt (old_stmt, stmt); } else --- 4031,4036 ----