public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Richard Biener <rguenther@suse.de>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>,
	Jakub Jelinek <jakub@redhat.com>,	<schwab@linux-m68k.org>
Subject: Re: [PING][PATCH][PR65443] Add transform_to_exit_first_loop_alt
Date: Mon, 08 Jun 2015 10:44:00 -0000	[thread overview]
Message-ID: <557571B5.1060903@mentor.com> (raw)
In-Reply-To: <55700C12.9000801@mentor.com>

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

On 04/06/15 10:28, Tom de Vries wrote:
>> I'm ok with the patch and count on you to fix eventual fallout ;)
>>
>
> Great, will do.

And here is the fallout:
* PR66442 - [6 regression] FAIL: gcc.dg/autopar/pr46885.c (test for
   excess errors)

There are two problems in try_transform_to_exit_first_loop_alt:
1. In case the latch is not a singleton bb, the function should return
    false rather than true.
2. The check for singleton bb should ignore debug-insns.

Attached patch fixes these problems.

Bootstrapped and reg-tested on x86_64.

Verified by Andreas to fix the problem on m68k.

OK for trunk?

Thanks,
- Tom


[-- Attachment #2: 0001-Fix-try_transform_to_exit_first_loop_alt.patch --]
[-- Type: text/x-patch, Size: 2067 bytes --]

Fix try_transform_to_exit_first_loop_alt

2015-06-06  Tom de Vries  <tom@codesourcery.com>

	PR tree-optimization/66442
	* gimple-iterator.h (gimple_seq_nondebug_singleton_p): Add function.
	* tree-parloops.c (try_transform_to_exit_first_loop_alt): Return false
	if the loop latch is not a singleton.  Use
	gimple_seq_nondebug_singleton_p instead of gimple_seq_singleton_p.
---
 gcc/gimple-iterator.h | 29 +++++++++++++++++++++++++++++
 gcc/tree-parloops.c   |  4 ++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/gcc/gimple-iterator.h b/gcc/gimple-iterator.h
index 87e943a..76fa456 100644
--- a/gcc/gimple-iterator.h
+++ b/gcc/gimple-iterator.h
@@ -345,4 +345,33 @@ gsi_seq (gimple_stmt_iterator i)
   return *i.seq;
 }
 
+/* Determine whether SEQ is a nondebug singleton.  */
+
+static inline bool
+gimple_seq_nondebug_singleton_p (gimple_seq seq)
+{
+  gimple_stmt_iterator gsi;
+
+  /* Find a nondebug gimple.  */
+  gsi.ptr = gimple_seq_first (seq);
+  gsi.seq = &seq;
+  gsi.bb = NULL;
+  while (!gsi_end_p (gsi)
+	 && is_gimple_debug (gsi_stmt (gsi)))
+    gsi_next (&gsi);
+
+  /* No nondebug gimple found, not a singleton.  */
+  if (gsi_end_p (gsi))
+    return false;
+
+  /* Find a next nondebug gimple.  */
+  gsi_next (&gsi);
+  while (!gsi_end_p (gsi)
+	 && is_gimple_debug (gsi_stmt (gsi)))
+    gsi_next (&gsi);
+
+  /* Only a singleton if there's no next nondebug gimple.  */
+  return gsi_end_p (gsi);
+}
+
 #endif /* GCC_GIMPLE_ITERATOR_H */
diff --git a/gcc/tree-parloops.c b/gcc/tree-parloops.c
index 02f44eb..c4b83fe 100644
--- a/gcc/tree-parloops.c
+++ b/gcc/tree-parloops.c
@@ -1769,8 +1769,8 @@ try_transform_to_exit_first_loop_alt (struct loop *loop,
 				      tree nit)
 {
   /* Check whether the latch contains a single statement.  */
-  if (!gimple_seq_singleton_p (bb_seq (loop->latch)))
-    return true;
+  if (!gimple_seq_nondebug_singleton_p (bb_seq (loop->latch)))
+    return false;
 
   /* Check whether the latch contains the loop iv increment.  */
   edge back = single_succ_edge (loop->latch);
-- 
1.9.1


  reply	other threads:[~2015-06-08 10:43 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-27 14:10 [PATCH, stage1][PR65443] " Tom de Vries
2015-04-03 12:40 ` Tom de Vries
2015-04-15 13:39   ` [PING][PATCH][PR65443] " Tom de Vries
2015-04-20 12:26     ` Richard Biener
2015-05-14 11:47       ` Tom de Vries
2015-05-26 11:05         ` Richard Biener
2015-06-04  8:37           ` Tom de Vries
2015-06-08 10:44             ` Tom de Vries [this message]
2015-06-08 11:08               ` Richard Biener
2015-06-08 15:59               ` Thomas Schwinge
2015-06-08 22:12                 ` Tom de Vries
2015-06-09  7:47                   ` Tom de Vries
2015-06-01  8:12         ` [gomp4,committed,PR65443] Add transform_to_exit_first_loop_al Tom de Vries

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=557571B5.1060903@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    --cc=rguenther@suse.de \
    --cc=schwab@linux-m68k.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).