public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <law@redhat.com>
To: Michael Matz <matz@suse.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Minor refactoring in tree-ssanames.c & freelists verifier
Date: Mon, 09 Nov 2015 19:59:00 -0000	[thread overview]
Message-ID: <5640FB23.7000108@redhat.com> (raw)
In-Reply-To: <alpine.LSU.2.20.1511091537500.11029@wotan.suse.de>

[-- Attachment #1: Type: text/plain, Size: 1186 bytes --]

On 11/09/2015 08:00 AM, Michael Matz wrote:
> Hi,
>
> On Mon, 9 Nov 2015, Jeff Law wrote:
>
> +verify_ssaname_freelists (struct function *fun)
> +{
> +  /* Do nothing if we are in RTL format.  */
> +  basic_block bb;
> +  FOR_EACH_BB_FN (bb, fun)
> +    {
> +      if (bb->flags & BB_RTL)
> +       return;
> +    }
>
> gimple_in_ssa_p (fun);
Agreed & fixed.

>
> +      /* Then note the operands of each statement.  */
> +      for (gimple_stmt_iterator gsi = gsi_start_bb (bb);
> +          !gsi_end_p (gsi);
> +          gsi_next (&gsi))
> +       {
> +         ssa_op_iter iter;
> +         gimple *stmt = gsi_stmt (gsi);
> +         FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, SSA_OP_ALL_OPERANDS)
> +           if (TREE_CODE (t) == SSA_NAME)
> +             bitmap_set_bit (names_in_il, SSA_NAME_VERSION (t));
> +       }
>
> t will always be an SSA_NAME here.
Likewise.  I think that test was in there from a time when I'd run the 
verifier at a different point in the pipeline and things weren't 
necessarily consistent.  I'll simplify in the obvious way.

I put bootstrapped x86_64-linux-gnu with the verifier enabled. 
Installed on the trunk.

Thanks for catching these.


Jeff

[-- Attachment #2: P --]
[-- Type: text/plain, Size: 2538 bytes --]

commit 681292298ad97eebda56fa64f00c772c2c3c7e29
Author: law <law@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Nov 9 19:56:57 2015 +0000

    Re: [PATCH] Minor refactoring in tree-ssanames.c & freelists verifier
    
    	* tree-ssanames.c (verify_ssaname_freelists): Simplify check for
    	being in gimple/ssa form.  Remove redundant check for SSA_NAME.
    	Fix comment typo.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@230049 138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 7911804..43a8d49 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2015-11-09  Jeff Law  <law@redhat.com>
+
+	* tree-ssanames.c (verify_ssaname_freelists): Simplify check for
+	being in gimple/ssa form.  Remove redundant check for SSA_NAME.
+	Fix comment typo.
+
 2015-11-09  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
 	* config/rs6000/rs6000.opt (-mpower9-fusion): Add new switches for
diff --git a/gcc/tree-ssanames.c b/gcc/tree-ssanames.c
index 096b75b..b599bb5 100644
--- a/gcc/tree-ssanames.c
+++ b/gcc/tree-ssanames.c
@@ -124,17 +124,13 @@ ssanames_print_statistics (void)
 DEBUG_FUNCTION void
 verify_ssaname_freelists (struct function *fun)
 {
-  /* Do nothing if we are in RTL format.  */
-  basic_block bb;
-  FOR_EACH_BB_FN (bb, fun)
-    {
-      if (bb->flags & BB_RTL)
-	return;
-    }
+  if (!gimple_in_ssa_p (fun))
+    return;
 
   bitmap names_in_il = BITMAP_ALLOC (NULL);
 
   /* Walk the entire IL noting every SSA_NAME we see.  */
+  basic_block bb;
   FOR_EACH_BB_FN (bb, fun)
     {
       tree t;
@@ -163,8 +159,7 @@ verify_ssaname_freelists (struct function *fun)
 	  ssa_op_iter iter;
 	  gimple *stmt = gsi_stmt (gsi);
 	  FOR_EACH_SSA_TREE_OPERAND (t, stmt, iter, SSA_OP_ALL_OPERANDS)
-	    if (TREE_CODE (t) == SSA_NAME)
-	      bitmap_set_bit (names_in_il, SSA_NAME_VERSION (t));
+	    bitmap_set_bit (names_in_il, SSA_NAME_VERSION (t));
 	}
     }
 
@@ -218,7 +213,7 @@ verify_ssaname_freelists (struct function *fun)
      debug/non-debug compilations have the same SSA_NAMEs.  So for each
      lost SSA_NAME, see if it's likely one from that wart.  These will always
      be marked as default definitions.  So we loosely assume that anything
-     marked as a default definition isn't leaked by pretening they are
+     marked as a default definition isn't leaked by pretending they are
      in the IL.  */
   for (unsigned int i = UNUSED_NAME_VERSION + 1; i < num_ssa_names; i++)
     if (ssa_name (i) && SSA_NAME_IS_DEFAULT_DEF (ssa_name (i)))

      reply	other threads:[~2015-11-09 19:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-09  9:02 Jeff Law
2015-11-09 15:00 ` Michael Matz
2015-11-09 19:59   ` Jeff Law [this message]

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=5640FB23.7000108@redhat.com \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=matz@suse.de \
    /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).