On Fri, 27 Jul 2012, Richard Guenther wrote: > > This avoids triggering update-ssa right after into-ssa just because > we didn't rename virtual operands yet. Simply do that on-the-fly, > update_stmt will have added bare symbols as operands already. > Surprisingly simple ... no idea why I chose the "simple" route > when merging alias-improvements (originally the first 'alias' pass > enabled virtual operands). > > Btw, we still have no virtual operands at -O0, it would now become > a tiny bit cheaper to add them (just to remove some !optimize checks). > > Bootstrap and regtest pending on x86_64-unknown-linux-gnu.
The following is what I have applied after bootstrap & regtest. Richard. 2012-07-30 Richard Guenther <rguent...@suse.de> * tree-into-ssa.c (mark_def_sites): Also process virtual operands. (rewrite_stmt): Likewise. (rewrite_enter_block): Likewise. (pass_build_ssa): Do not update virtual SSA form during TODO. (mark_symbol_for_renaming): Do nothing if we are not in SSA form. * lto-streamer-in.c (lto_read_body): Set in_ssa_p earlier. * gcc.dg/ipa/ipa-pta-3.c: Adjust. * gcc.dg/ipa/ipa-pta-4.c: Likewise. * gcc.dg/tm/memopt-3.c: Likewise. Index: trunk/gcc/tree-into-ssa.c =================================================================== *** trunk.orig/gcc/tree-into-ssa.c 2012-07-30 11:27:06.000000000 +0200 --- trunk/gcc/tree-into-ssa.c 2012-07-30 11:34:59.588077320 +0200 *************** mark_def_sites (basic_block bb, gimple s *** 675,681 **** /* If a variable is used before being set, then the variable is live across a block boundary, so mark it live-on-entry to BB. */ ! FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) { tree sym = USE_FROM_PTR (use_p); gcc_assert (DECL_P (sym)); --- 675,681 ---- /* If a variable is used before being set, then the variable is live across a block boundary, so mark it live-on-entry to BB. */ ! FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) { tree sym = USE_FROM_PTR (use_p); gcc_assert (DECL_P (sym)); *************** mark_def_sites (basic_block bb, gimple s *** 686,692 **** /* Now process the defs. Mark BB as the definition block and add each def to the set of killed symbols. */ ! FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_DEF) { gcc_assert (DECL_P (def)); set_def_block (def, bb, false); --- 686,692 ---- /* Now process the defs. Mark BB as the definition block and add each def to the set of killed symbols. */ ! FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS) { gcc_assert (DECL_P (def)); set_def_block (def, bb, false); *************** rewrite_stmt (gimple_stmt_iterator si) *** 1336,1342 **** if (is_gimple_debug (stmt)) rewrite_debug_stmt_uses (stmt); else ! FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE) { tree var = USE_FROM_PTR (use_p); gcc_assert (DECL_P (var)); --- 1336,1342 ---- if (is_gimple_debug (stmt)) rewrite_debug_stmt_uses (stmt); else ! FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_ALL_USES) { tree var = USE_FROM_PTR (use_p); gcc_assert (DECL_P (var)); *************** rewrite_stmt (gimple_stmt_iterator si) *** 1346,1352 **** /* Step 2. Register the statement's DEF operands. */ if (register_defs_p (stmt)) ! FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_DEF) { tree var = DEF_FROM_PTR (def_p); tree name = make_ssa_name (var, stmt); --- 1346,1352 ---- /* Step 2. Register the statement's DEF operands. */ if (register_defs_p (stmt)) ! FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, iter, SSA_OP_ALL_DEFS) { tree var = DEF_FROM_PTR (def_p); tree name = make_ssa_name (var, stmt); *************** static void *** 1404,1410 **** rewrite_enter_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED, basic_block bb) { - gimple phi; gimple_stmt_iterator gsi; if (dump_file && (dump_flags & TDF_DETAILS)) --- 1404,1409 ---- *************** rewrite_enter_block (struct dom_walk_dat *** 1418,1428 **** node introduces a new version for the associated variable. */ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { ! tree result; ! ! phi = gsi_stmt (gsi); ! result = gimple_phi_result (phi); ! gcc_assert (is_gimple_reg (result)); register_new_def (result, SSA_NAME_VAR (result)); } --- 1417,1423 ---- node introduces a new version for the associated variable. */ for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { ! tree result = gimple_phi_result (gsi_stmt (gsi)); register_new_def (result, SSA_NAME_VAR (result)); } *************** struct gimple_opt_pass pass_build_ssa = *** 2437,2444 **** PROP_ssa, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ ! TODO_update_ssa_only_virtuals ! | TODO_verify_ssa | TODO_remove_unused_locals /* todo_flags_finish */ } }; --- 2432,2438 ---- PROP_ssa, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ ! TODO_verify_ssa | TODO_remove_unused_locals /* todo_flags_finish */ } }; *************** register_new_name_mapping (tree new_tree *** 2889,2895 **** void mark_sym_for_renaming (tree sym) { ! bitmap_set_bit (SYMS_TO_RENAME (cfun), DECL_UID (sym)); } --- 2883,2890 ---- void mark_sym_for_renaming (tree sym) { ! if (cfun->gimple_df->in_ssa_p) ! bitmap_set_bit (SYMS_TO_RENAME (cfun), DECL_UID (sym)); } Index: trunk/gcc/lto-streamer-in.c =================================================================== *** trunk.orig/gcc/lto-streamer-in.c 2012-07-30 11:41:09.000000000 +0200 --- trunk/gcc/lto-streamer-in.c 2012-07-30 11:41:15.183064311 +0200 *************** lto_read_body (struct lto_file_decl_data *** 979,984 **** --- 979,987 ---- push_cfun (fn); init_tree_ssa (fn); + /* We input IL in SSA form. */ + cfun->gimple_df->in_ssa_p = true; + /* Use the function's decl state. */ decl_state = lto_get_function_in_decl_state (file_data, fn_decl); gcc_assert (decl_state); *************** lto_read_body (struct lto_file_decl_data *** 1015,1023 **** } } - /* We should now be in SSA. */ - cfun->gimple_df->in_ssa_p = true; - /* Restore decl state */ file_data->current_decl_state = file_data->global_decl_state; --- 1018,1023 ----