public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR56605
@ 2013-03-13 17:08 Bill Schmidt
       [not found] ` <1452175.pczBboUvvn@polaris>
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Schmidt @ 2013-03-13 17:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: bergner, steven

This patch (suggested by Steven B) removes some redundant loop
assertions that are currently being missed, resulting in redundant
branches appearing prior to many loops on powerpc64.  Bootstrapped and
tested with no new regressions on powerpc64-unknown-linux-gnu.  Ok for
trunk?

Thanks,
Bill


gcc:

2013-03-13  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
	    Steven Bosscher <steven@gcc.gnu.org>

	PR rtl-optimization/56605
	* loop-iv.c (implies_p): Handle equal RTXs and subregs.

gcc/testsuite:

2013-03-13  Bill Schmidt  wschmidt@linux.vnet.ibm.com>

	PR rtl-optimization/56605
	* gcc.target/powerpc/pr56605.c: New.



Index: gcc/testsuite/gcc.target/powerpc/pr56605.c
===================================================================
--- gcc/testsuite/gcc.target/powerpc/pr56605.c	(revision 0)
+++ gcc/testsuite/gcc.target/powerpc/pr56605.c	(revision 0)
@@ -0,0 +1,13 @@
+/* PR rtl-optimization/56605 */
+/* { dg-do compile { target { powerpc64-*-* && lp64 } } } */
+/* { dg-options "-O3 -mvsx -mcpu=power7 -fno-unroll-loops -fdump-rtl-loop2_doloop" } */
+
+void foo (short* __restrict sb, int* __restrict ia)
+{
+  int i;
+  for (i = 0; i < 4000; i++)
+    ia[i] = (int) sb[i];
+}
+
+/* { dg-final { scan-rtl-dump-times "\\\(compare:CC \\\(subreg:SI \\\(reg:DI" 1 "loop2_doloop" } } */
+/* { dg-final { cleanup-rtl-dump "loop2_doloop" } } */
Index: gcc/loop-iv.c
===================================================================
--- gcc/loop-iv.c	(revision 196633)
+++ gcc/loop-iv.c	(working copy)
@@ -1496,19 +1496,26 @@ implies_p (rtx a, rtx b)
   rtx op0, op1, opb0, opb1, r;
   enum machine_mode mode;
 
+  if (rtx_equal_p (a, b))
+    return true;
+
   if (GET_CODE (a) == EQ)
     {
       op0 = XEXP (a, 0);
       op1 = XEXP (a, 1);
 
-      if (REG_P (op0))
+      if (REG_P (op0)
+	  || (GET_CODE (op0) == SUBREG
+	      && REG_P (SUBREG_REG (op0))))
 	{
 	  r = simplify_replace_rtx (b, op0, op1);
 	  if (r == const_true_rtx)
 	    return true;
 	}
 
-      if (REG_P (op1))
+      if (REG_P (op1)
+	  || (GET_CODE (op1) == SUBREG
+	      && REG_P (SUBREG_REG (op1))))
 	{
 	  r = simplify_replace_rtx (b, op1, op0);
 	  if (r == const_true_rtx)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix PR56605
       [not found] ` <1452175.pczBboUvvn@polaris>
@ 2013-03-20 13:45   ` Bill Schmidt
  2013-03-20 13:50     ` Jakub Jelinek
  0 siblings, 1 reply; 4+ messages in thread
From: Bill Schmidt @ 2013-03-20 13:45 UTC (permalink / raw)
  To: Eric Botcazou; +Cc: gcc-patches, bergner, steven, rguenther, jakub

Eric, thanks -- fixed in trunk.  Looks like I've missed the window for
4.8.0.  Is this OK for backport once 4.8 opens up again?  (Copying
Richi/Jakub as well.)

Thanks,
Bill

On Mon, 2013-03-18 at 17:31 +0100, Eric Botcazou wrote:
> > 2013-03-13  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> > 	    Steven Bosscher <steven@gcc.gnu.org>
> > 
> > 	PR rtl-optimization/56605
> > 	* loop-iv.c (implies_p): Handle equal RTXs and subregs.
> > 
> > gcc/testsuite:
> > 
> > 2013-03-13  Bill Schmidt  wschmidt@linux.vnet.ibm.com>
> > 
> > 	PR rtl-optimization/56605
> > 	* gcc.target/powerpc/pr56605.c: New.
> 
> OK, thanks.
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix PR56605
  2013-03-20 13:45   ` Bill Schmidt
@ 2013-03-20 13:50     ` Jakub Jelinek
  2013-03-20 14:00       ` Bill Schmidt
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Jelinek @ 2013-03-20 13:50 UTC (permalink / raw)
  To: Bill Schmidt; +Cc: Eric Botcazou, gcc-patches, bergner, steven, rguenther

On Wed, Mar 20, 2013 at 08:45:16AM -0500, Bill Schmidt wrote:
> Eric, thanks -- fixed in trunk.  Looks like I've missed the window for
> 4.8.0.  Is this OK for backport once 4.8 opens up again?  (Copying
> Richi/Jakub as well.)

Not for 4.8.0 (this isn't a wrong-code, just missed-optimization, right?),
but guess for 4.8.1 it might be ok if it doesn't cause any issues on the
trunk for a few weeks.

> On Mon, 2013-03-18 at 17:31 +0100, Eric Botcazou wrote:
> > > 2013-03-13  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> > > 	    Steven Bosscher <steven@gcc.gnu.org>
> > > 
> > > 	PR rtl-optimization/56605
> > > 	* loop-iv.c (implies_p): Handle equal RTXs and subregs.
> > > 
> > > gcc/testsuite:
> > > 
> > > 2013-03-13  Bill Schmidt  wschmidt@linux.vnet.ibm.com>
> > > 
> > > 	PR rtl-optimization/56605
> > > 	* gcc.target/powerpc/pr56605.c: New.
> > 
> > OK, thanks.

	Jakub

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Fix PR56605
  2013-03-20 13:50     ` Jakub Jelinek
@ 2013-03-20 14:00       ` Bill Schmidt
  0 siblings, 0 replies; 4+ messages in thread
From: Bill Schmidt @ 2013-03-20 14:00 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: Eric Botcazou, gcc-patches, bergner, steven, rguenther

On Wed, 2013-03-20 at 14:50 +0100, Jakub Jelinek wrote:
> On Wed, Mar 20, 2013 at 08:45:16AM -0500, Bill Schmidt wrote:
> > Eric, thanks -- fixed in trunk.  Looks like I've missed the window for
> > 4.8.0.  Is this OK for backport once 4.8 opens up again?  (Copying
> > Richi/Jakub as well.)
> 
> Not for 4.8.0 (this isn't a wrong-code, just missed-optimization, right?),
> but guess for 4.8.1 it might be ok if it doesn't cause any issues on the
> trunk for a few weeks.

Correct, just missed optimization.  OK, I'll revisit it for 4.8 sometime
next month.  Thanks!

Bill

> 
> > On Mon, 2013-03-18 at 17:31 +0100, Eric Botcazou wrote:
> > > > 2013-03-13  Bill Schmidt  <wschmidt@linux.vnet.ibm.com>
> > > > 	    Steven Bosscher <steven@gcc.gnu.org>
> > > > 
> > > > 	PR rtl-optimization/56605
> > > > 	* loop-iv.c (implies_p): Handle equal RTXs and subregs.
> > > > 
> > > > gcc/testsuite:
> > > > 
> > > > 2013-03-13  Bill Schmidt  wschmidt@linux.vnet.ibm.com>
> > > > 
> > > > 	PR rtl-optimization/56605
> > > > 	* gcc.target/powerpc/pr56605.c: New.
> > > 
> > > OK, thanks.
> 
> 	Jakub
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-03-20 14:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-13 17:08 [PATCH] Fix PR56605 Bill Schmidt
     [not found] ` <1452175.pczBboUvvn@polaris>
2013-03-20 13:45   ` Bill Schmidt
2013-03-20 13:50     ` Jakub Jelinek
2013-03-20 14:00       ` Bill Schmidt

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).