public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH][RFC] Virtual operands in loop-closed SSA form
Date: Wed, 22 Aug 2012 13:04:00 -0000	[thread overview]
Message-ID: <alpine.LNX.2.00.1208221458550.28649@zhemvz.fhfr.qr> (raw)


While we should already be in loop-closed SSA form for virtual
operands most of the time (because we have a virtual use at
the return statement) and loop-closed SSA form for virtuals
is cheap (we only have a single virtual operand now) the following
makes sure that a loop-closed PHI node for virtuals does exist.

Nobody makes use of the fact but ISTR code that has code explicitely
dealing with the situation that virtuals are _not_ in loop-closed
SSA form.

Testing pending.

Richard.

2012-08-22  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-loop-manip.c (add_exit_phis_var): Allow virtual operands.
	(find_uses_to_rename_use): Likewise.
	(find_uses_to_rename_bb): Likewise.
	(find_uses_to_rename_stmt): Walk over all operands.

Index: gcc/tree-ssa-loop-manip.c
===================================================================
--- gcc/tree-ssa-loop-manip.c	(revision 190590)
+++ gcc/tree-ssa-loop-manip.c	(working copy)
@@ -303,8 +303,7 @@ add_exit_phis_var (tree var, bitmap use_
   basic_block def_bb = gimple_bb (SSA_NAME_DEF_STMT (var));
   bitmap live_exits = BITMAP_ALLOC (&loop_renamer_obstack);
 
-  gcc_checking_assert (! virtual_operand_p (var));
-  gcc_assert (! bitmap_bit_p (use_blocks, def_bb->index));
+  gcc_checking_assert (! bitmap_bit_p (use_blocks, def_bb->index));
 
   compute_live_loop_exits (live_exits, use_blocks, loop_exits, def_bb);
 
@@ -367,10 +366,6 @@ find_uses_to_rename_use (basic_block bb,
   if (TREE_CODE (use) != SSA_NAME)
     return;
 
-  /* We don't need to keep virtual operands in loop-closed form.  */
-  if (virtual_operand_p (use))
-    return;
-
   ver = SSA_NAME_VERSION (use);
   def_bb = gimple_bb (SSA_NAME_DEF_STMT (use));
   if (!def_bb)
@@ -408,7 +403,7 @@ find_uses_to_rename_stmt (gimple stmt, b
   if (is_gimple_debug (stmt))
     return;
 
-  FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_USE)
+  FOR_EACH_SSA_TREE_OPERAND (var, stmt, iter, SSA_OP_ALL_USES)
     find_uses_to_rename_use (bb, var, use_blocks, need_phis);
 }
 
@@ -428,9 +423,8 @@ find_uses_to_rename_bb (basic_block bb,
     for (bsi = gsi_start_phis (e->dest); !gsi_end_p (bsi); gsi_next (&bsi))
       {
         gimple phi = gsi_stmt (bsi);
-	if (! virtual_operand_p (gimple_phi_result (phi)))
-	  find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (phi, e),
-				   use_blocks, need_phis);
+	find_uses_to_rename_use (bb, PHI_ARG_DEF_FROM_EDGE (phi, e),
+				 use_blocks, need_phis);
       }
 
   for (bsi = gsi_start_bb (bb); !gsi_end_p (bsi); gsi_next (&bsi))

             reply	other threads:[~2012-08-22 13:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-22 13:04 Richard Guenther [this message]
2012-08-22 17:48 ` Steven Bosscher
2012-08-23  7:37   ` Richard Guenther
2012-08-23  7:58     ` Steven Bosscher

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.1208221458550.28649@zhemvz.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).