From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][4/n] into-SSA TLC
Date: Fri, 27 Jul 2012 13:22:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.00.1207271515311.17088@jbgna.fhfr.qr> (raw)
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.
Richard.
2012-07-27 Richard Guenther <rguenther@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.
Index: trunk/gcc/tree-into-ssa.c
===================================================================
*** trunk.orig/gcc/tree-into-ssa.c 2012-07-27 14:49:48.000000000 +0200
--- trunk/gcc/tree-into-ssa.c 2012-07-27 15:12:29.091599852 +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));
}
next reply other threads:[~2012-07-27 13:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-27 13:22 Richard Guenther [this message]
2012-07-30 11:15 ` Richard Guenther
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.00.1207271515311.17088@jbgna.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).