public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [patch] Fix PR tree-optimization/49471
@ 2011-07-25 14:59 Razya Ladelsky
  2011-07-25 15:02 ` Richard Guenther
  0 siblings, 1 reply; 10+ messages in thread
From: Razya Ladelsky @ 2011-07-25 14:59 UTC (permalink / raw)
  To: gcc-patches; +Cc: Zdenek Dvorak, Richard Guenther

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

Hi,

This patch fixes the build failure of cactusADM and dealII spec2006 
benchmarks when autopar is enabled.
(for powerpc they fail only when -m32 is additionally enabled)

The problem originated in canonicalize_loop_ivs, where we iterate the 
header's phis in order to base all
the induction variables on a single control variable.
We use the largest precision of the loop's ivs in order to determine the 
type of the control variable. 

Since iterating the loop's phis takes into account not only the loop's 
ivs, but also reduction variables, 
we got precision values like 80 for x86, or 128 for ppc.
The compilers failed to create proper types for these sizes 
(respectively).

The proper behavior for determining the control variable's type is to take 
into account only the loop's ivs,
which is what this patch does. 

Bootstrap and testsuite pass successfully (as autopar is not enabled by 
default).
No new regressions when the testsuite is run with autopar enabled.
No new regressions for the run of spec2006 with autopar enabled, 

cactusADM and dealII benchmarks now pass successfully with autopar on 
powerpc and x86.

Thanks to Zdenek who helped me figure out the failure/fix. 
OK for trunk? 
Thanks,
Razya

ChangeLog:

   PR tree-optimization/49471
   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to 
   ignore reduction variables when iterating the loop header's phis.



[-- Attachment #2: cactus_dealII_patch.txt --]
[-- Type: text/plain, Size: 1085 bytes --]

Index: tree-ssa-loop-manip.c
===================================================================
*** tree-ssa-loop-manip.c	(revision 175851)
--- tree-ssa-loop-manip.c	(working copy)
*************** canonicalize_loop_ivs (struct loop *loop
*** 1200,1205 ****
--- 1200,1206 ----
    gimple stmt;
    edge exit = single_dom_exit (loop);
    gimple_seq stmts;
+   affine_iv iv;
  
    for (psi = gsi_start_phis (loop->header);
         !gsi_end_p (psi); gsi_next (&psi))
*************** canonicalize_loop_ivs (struct loop *loop
*** 1207,1213 ****
        gimple phi = gsi_stmt (psi);
        tree res = PHI_RESULT (phi);
  
!       if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
  	precision = TYPE_PRECISION (TREE_TYPE (res));
      }
  
--- 1208,1216 ----
        gimple phi = gsi_stmt (psi);
        tree res = PHI_RESULT (phi);
  
!       if (is_gimple_reg (res) 
! 	  && simple_iv (loop, loop, res, &iv, true)
! 	  && TYPE_PRECISION (TREE_TYPE (res)) > precision)
  	precision = TYPE_PRECISION (TREE_TYPE (res));
      }
  
=

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-25 14:59 [patch] Fix PR tree-optimization/49471 Razya Ladelsky
@ 2011-07-25 15:02 ` Richard Guenther
  2011-07-26 13:53   ` Razya Ladelsky
  2011-07-30 21:56   ` Zdenek Dvorak
  0 siblings, 2 replies; 10+ messages in thread
From: Richard Guenther @ 2011-07-25 15:02 UTC (permalink / raw)
  To: Razya Ladelsky; +Cc: gcc-patches, Zdenek Dvorak, Sebastian Pop

On Mon, Jul 25, 2011 at 4:47 PM, Razya Ladelsky <RAZYA@il.ibm.com> wrote:
> Hi,
>
> This patch fixes the build failure of cactusADM and dealII spec2006
> benchmarks when autopar is enabled.
> (for powerpc they fail only when -m32 is additionally enabled)
>
> The problem originated in canonicalize_loop_ivs, where we iterate the
> header's phis in order to base all
> the induction variables on a single control variable.
> We use the largest precision of the loop's ivs in order to determine the
> type of the control variable.
>
> Since iterating the loop's phis takes into account not only the loop's
> ivs, but also reduction variables,
> we got precision values like 80 for x86, or 128 for ppc.
> The compilers failed to create proper types for these sizes
> (respectively).
>
> The proper behavior for determining the control variable's type is to take
> into account only the loop's ivs,
> which is what this patch does.
>
> Bootstrap and testsuite pass successfully (as autopar is not enabled by
> default).
> No new regressions when the testsuite is run with autopar enabled.
> No new regressions for the run of spec2006 with autopar enabled,
>
> cactusADM and dealII benchmarks now pass successfully with autopar on
> powerpc and x86.
>
> Thanks to Zdenek who helped me figure out the failure/fix.
> OK for trunk?

It'll collide with Sebastians patch in that area.  I suggested a
INTEGRAL_TYPE_P check instead of the simple_iv one, it
should be cheaper.  Zdenek, do you think it will be "incorrect"
in some cases?

Thanks,
Richard.

> Thanks,
> Razya
>
> ChangeLog:
>
>   PR tree-optimization/49471
>   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to
>   ignore reduction variables when iterating the loop header's phis.
>
>
>

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-25 15:02 ` Richard Guenther
@ 2011-07-26 13:53   ` Razya Ladelsky
  2011-07-26 14:07     ` Richard Guenther
  2011-07-30 21:56   ` Zdenek Dvorak
  1 sibling, 1 reply; 10+ messages in thread
From: Razya Ladelsky @ 2011-07-26 13:53 UTC (permalink / raw)
  To: Richard Guenther; +Cc: gcc-patches, Zdenek Dvorak, Sebastian Pop

Richard Guenther <richard.guenther@gmail.com> wrote on 25/07/2011 05:54:28 
PM:

> From: Richard Guenther <richard.guenther@gmail.com>
> To: Razya Ladelsky/Haifa/IBM@IBMIL
> Cc: gcc-patches@gcc.gnu.org, Zdenek Dvorak 
> <rakdver@kam.mff.cuni.cz>, Sebastian Pop <spop@gcc.gnu.org>
> Date: 25/07/2011 05:54 PM
> Subject: Re: [patch] Fix PR tree-optimization/49471
> 
> On Mon, Jul 25, 2011 at 4:47 PM, Razya Ladelsky <RAZYA@il.ibm.com> 
wrote:
> > Hi,
> >
> > This patch fixes the build failure of cactusADM and dealII spec2006
> > benchmarks when autopar is enabled.
> > (for powerpc they fail only when -m32 is additionally enabled)
> >
> > The problem originated in canonicalize_loop_ivs, where we iterate the
> > header's phis in order to base all
> > the induction variables on a single control variable.
> > We use the largest precision of the loop's ivs in order to determine 
the
> > type of the control variable.
> >
> > Since iterating the loop's phis takes into account not only the loop's
> > ivs, but also reduction variables,
> > we got precision values like 80 for x86, or 128 for ppc.
> > The compilers failed to create proper types for these sizes
> > (respectively).
> >
> > The proper behavior for determining the control variable's type is to 
take
> > into account only the loop's ivs,
> > which is what this patch does.
> >
> > Bootstrap and testsuite pass successfully (as autopar is not enabled 
by
> > default).
> > No new regressions when the testsuite is run with autopar enabled.
> > No new regressions for the run of spec2006 with autopar enabled,
> >
> > cactusADM and dealII benchmarks now pass successfully with autopar on
> > powerpc and x86.
> >
> > Thanks to Zdenek who helped me figure out the failure/fix.
> > OK for trunk?
> 
> It'll collide with Sebastians patch in that area.  I suggested a
> INTEGRAL_TYPE_P check instead of the simple_iv one, it
> should be cheaper.  Zdenek, do you think it will be "incorrect"
> in some cases?
> 

The INTEGRAL_TYPE_P check does work for cactusADM and dealII, but
I'm not sure about the general case.

Razya


> Thanks,
> Richard.
> 
> > Thanks,
> > Razya
> >
> > ChangeLog:
> >
> >   PR tree-optimization/49471
> >   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to
> >   ignore reduction variables when iterating the loop header's phis.
> >
> >
> >

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-26 13:53   ` Razya Ladelsky
@ 2011-07-26 14:07     ` Richard Guenther
  2011-07-26 18:27       ` Sebastian Pop
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Guenther @ 2011-07-26 14:07 UTC (permalink / raw)
  To: Razya Ladelsky; +Cc: gcc-patches, Zdenek Dvorak, Sebastian Pop

On Tue, Jul 26, 2011 at 2:59 PM, Razya Ladelsky <RAZYA@il.ibm.com> wrote:
> Richard Guenther <richard.guenther@gmail.com> wrote on 25/07/2011 05:54:28
> PM:
>
>> From: Richard Guenther <richard.guenther@gmail.com>
>> To: Razya Ladelsky/Haifa/IBM@IBMIL
>> Cc: gcc-patches@gcc.gnu.org, Zdenek Dvorak
>> <rakdver@kam.mff.cuni.cz>, Sebastian Pop <spop@gcc.gnu.org>
>> Date: 25/07/2011 05:54 PM
>> Subject: Re: [patch] Fix PR tree-optimization/49471
>>
>> On Mon, Jul 25, 2011 at 4:47 PM, Razya Ladelsky <RAZYA@il.ibm.com>
> wrote:
>> > Hi,
>> >
>> > This patch fixes the build failure of cactusADM and dealII spec2006
>> > benchmarks when autopar is enabled.
>> > (for powerpc they fail only when -m32 is additionally enabled)
>> >
>> > The problem originated in canonicalize_loop_ivs, where we iterate the
>> > header's phis in order to base all
>> > the induction variables on a single control variable.
>> > We use the largest precision of the loop's ivs in order to determine
> the
>> > type of the control variable.
>> >
>> > Since iterating the loop's phis takes into account not only the loop's
>> > ivs, but also reduction variables,
>> > we got precision values like 80 for x86, or 128 for ppc.
>> > The compilers failed to create proper types for these sizes
>> > (respectively).
>> >
>> > The proper behavior for determining the control variable's type is to
> take
>> > into account only the loop's ivs,
>> > which is what this patch does.
>> >
>> > Bootstrap and testsuite pass successfully (as autopar is not enabled
> by
>> > default).
>> > No new regressions when the testsuite is run with autopar enabled.
>> > No new regressions for the run of spec2006 with autopar enabled,
>> >
>> > cactusADM and dealII benchmarks now pass successfully with autopar on
>> > powerpc and x86.
>> >
>> > Thanks to Zdenek who helped me figure out the failure/fix.
>> > OK for trunk?
>>
>> It'll collide with Sebastians patch in that area.  I suggested a
>> INTEGRAL_TYPE_P check instead of the simple_iv one, it
>> should be cheaper.  Zdenek, do you think it will be "incorrect"
>> in some cases?
>>
>
> The INTEGRAL_TYPE_P check does work for cactusADM and dealII, but
> I'm not sure about the general case.

I suppose we also need to allow POINTER_TYPE_P here (but then
treat it like an unsigned variable of the same width).

Richard.

> Razya
>
>
>> Thanks,
>> Richard.
>>
>> > Thanks,
>> > Razya
>> >
>> > ChangeLog:
>> >
>> >   PR tree-optimization/49471
>> >   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to
>> >   ignore reduction variables when iterating the loop header's phis.
>> >
>> >
>> >
>
>

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-26 14:07     ` Richard Guenther
@ 2011-07-26 18:27       ` Sebastian Pop
  2011-07-27  9:41         ` Richard Guenther
  0 siblings, 1 reply; 10+ messages in thread
From: Sebastian Pop @ 2011-07-26 18:27 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Razya Ladelsky, gcc-patches, Zdenek Dvorak

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

On Tue, Jul 26, 2011 at 08:30, Richard Guenther
<richard.guenther@gmail.com> wrote:
> I suppose we also need to allow POINTER_TYPE_P here (but then
> treat it like an unsigned variable of the same width).

Updated patch.  Ok for trunk after regstrap?

Thanks,
Sebastian

[-- Attachment #2: 0001-Fix-PR49471-canonicalize_loop_ivs-should-not-generat.patch --]
[-- Type: text/x-diff, Size: 4807 bytes --]

From 3e8f8cfd0c4298b6b5e88c8bc7ba81a01e7cd815 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Sun, 24 Jul 2011 01:52:52 -0500
Subject: [PATCH] Fix PR49471: canonicalize_loop_ivs should not generate unsigned types.

2011-07-23  Sebastian Pop  <sebastian.pop@amd.com>

	PR tree-optimization/49471
	* tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned
	iv only when the largest type is unsigned.  Do not call
	lang_hooks.types.type_for_size.

	* testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail.
	* testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern.
---
 gcc/ChangeLog                                      |    7 +++++++
 gcc/tree-ssa-loop-manip.c                          |   19 ++++++++++++++++---
 libgomp/ChangeLog                                  |    5 +++++
 .../testsuite/libgomp.graphite/force-parallel-1.c  |    2 +-
 .../testsuite/libgomp.graphite/force-parallel-2.c  |    2 +-
 5 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 27d4001..17358a8 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,12 @@
 2011-07-23  Sebastian Pop  <sebastian.pop@amd.com>
 
+	PR tree-optimization/49471
+	* tree-ssa-loop-manip.c (canonicalize_loop_ivs): Build an unsigned
+	iv only when the largest type is unsigned.  Do not call
+	lang_hooks.types.type_for_size.
+
+2011-07-23  Sebastian Pop  <sebastian.pop@amd.com>
+
 	PR middle-end/47691
 	* graphite-clast-to-gimple.c (translate_clast_user): Update use of
 	copy_bb_and_scalar_dependences.
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c
index 8176ed8..f3392e6 100644
--- a/gcc/tree-ssa-loop-manip.c
+++ b/gcc/tree-ssa-loop-manip.c
@@ -1200,18 +1200,31 @@ canonicalize_loop_ivs (struct loop *loop, tree *nit, bool bump_in_latch)
   gimple stmt;
   edge exit = single_dom_exit (loop);
   gimple_seq stmts;
+  enum machine_mode mode;
+  bool unsigned_p = false;
 
   for (psi = gsi_start_phis (loop->header);
        !gsi_end_p (psi); gsi_next (&psi))
     {
       gimple phi = gsi_stmt (psi);
       tree res = PHI_RESULT (phi);
+      bool uns;
 
-      if (is_gimple_reg (res) && TYPE_PRECISION (TREE_TYPE (res)) > precision)
-	precision = TYPE_PRECISION (TREE_TYPE (res));
+      type = TREE_TYPE (res);
+      if (!is_gimple_reg (res)
+	  || (!INTEGRAL_TYPE_P (type)
+	      && !POINTER_TYPE_P (type))
+	  || TYPE_PRECISION (type) < precision)
+	continue;
+
+      uns = POINTER_TYPE_P (type) | TYPE_UNSIGNED (type);
+      unsigned_p = TYPE_PRECISION (type) > precision ? uns : unsigned_p | uns;
+      precision = TYPE_PRECISION (type);
     }
 
-  type = lang_hooks.types.type_for_size (precision, 1);
+  mode = smallest_mode_for_size (precision, MODE_INT);
+  precision = GET_MODE_PRECISION (mode);
+  type = build_nonstandard_integer_type (precision, unsigned_p);
 
   if (original_precision != precision)
     {
diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog
index 9225401..d5cd94d 100644
--- a/libgomp/ChangeLog
+++ b/libgomp/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-23  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* testsuite/libgomp.graphite/force-parallel-1.c: Un-xfail.
+	* testsuite/libgomp.graphite/force-parallel-2.c: Adjust pattern.
+
 2011-07-18  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	PR target/49541
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
index 71ed332..7f043d8 100644
--- a/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-1.c
@@ -23,7 +23,7 @@ int main(void)
 }
 
 /* Check that parallel code generation part make the right answer.  */
-/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" { xfail *-*-* } } } */
+/* { dg-final { scan-tree-dump-times "1 loops carried no dependency" 2 "graphite" } } */
 /* { dg-final { cleanup-tree-dump "graphite" } } */
 /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
 /* { dg-final { cleanup-tree-dump "parloops" } } */
diff --git a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
index 1ce0feb..03d8236 100644
--- a/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
+++ b/libgomp/testsuite/libgomp.graphite/force-parallel-2.c
@@ -23,7 +23,7 @@ int main(void)
 }
 
 /* Check that parallel code generation part make the right answer.  */
-/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 1 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "2 loops carried no dependency" 2 "graphite" } } */
 /* { dg-final { cleanup-tree-dump "graphite" } } */
 /* { dg-final { scan-tree-dump-times "loopfn" 5 "optimized" } } */
 /* { dg-final { cleanup-tree-dump "parloops" } } */
-- 
1.7.4.1


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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-26 18:27       ` Sebastian Pop
@ 2011-07-27  9:41         ` Richard Guenther
  0 siblings, 0 replies; 10+ messages in thread
From: Richard Guenther @ 2011-07-27  9:41 UTC (permalink / raw)
  To: Sebastian Pop; +Cc: Razya Ladelsky, gcc-patches, Zdenek Dvorak

On Tue, Jul 26, 2011 at 8:07 PM, Sebastian Pop <sebpop@gmail.com> wrote:
> On Tue, Jul 26, 2011 at 08:30, Richard Guenther
> <richard.guenther@gmail.com> wrote:
>> I suppose we also need to allow POINTER_TYPE_P here (but then
>> treat it like an unsigned variable of the same width).
>
> Updated patch.  Ok for trunk after regstrap?

+      uns = POINTER_TYPE_P (type) | TYPE_UNSIGNED (type);
+      unsigned_p = TYPE_PRECISION (type) > precision ? uns : unsigned_p | uns;

Um, operator precedence?  Ok if written with an if stmt.

Thanks,
Richard.

> Thanks,
> Sebastian
>

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-25 15:02 ` Richard Guenther
  2011-07-26 13:53   ` Razya Ladelsky
@ 2011-07-30 21:56   ` Zdenek Dvorak
  2011-07-31 10:45     ` Richard Guenther
  1 sibling, 1 reply; 10+ messages in thread
From: Zdenek Dvorak @ 2011-07-30 21:56 UTC (permalink / raw)
  To: richard.guenther; +Cc: Razya Ladelsky, gcc-patches, Sebastian Pop

Hi,

> > This patch fixes the build failure of cactusADM and dealII spec2006
> > benchmarks when autopar is enabled.
> > (for powerpc they fail only when -m32 is additionally enabled)
> >
> > The problem originated in canonicalize_loop_ivs, where we iterate the
> > header's phis in order to base all
> > the induction variables on a single control variable.
> > We use the largest precision of the loop's ivs in order to determine the
> > type of the control variable.
> >
> > Since iterating the loop's phis takes into account not only the loop's
> > ivs, but also reduction variables,
> > we got precision values like 80 for x86, or 128 for ppc.
> > The compilers failed to create proper types for these sizes
> > (respectively).
> >
> > The proper behavior for determining the control variable's type is to take
> > into account only the loop's ivs,
> > which is what this patch does.
> >
> > Bootstrap and testsuite pass successfully (as autopar is not enabled by
> > default).
> > No new regressions when the testsuite is run with autopar enabled.
> > No new regressions for the run of spec2006 with autopar enabled,
> >
> > cactusADM and dealII benchmarks now pass successfully with autopar on
> > powerpc and x86.
> >
> > Thanks to Zdenek who helped me figure out the failure/fix.
> > OK for trunk?
> 
> It'll collide with Sebastians patch in that area.  I suggested a
> INTEGRAL_TYPE_P check instead of the simple_iv one, it
> should be cheaper.  Zdenek, do you think it will be "incorrect"
> in some cases?

well, it does not make much sense -- reductions of integral type would
be taken into consideration for determining the size of the canonical
variable.  However, it is not a big issue (the choice of the type is more
or less arbitrary, as long as the number of iterations fits into it; selecting
the type based on another existing iv is just to avoid unnecessary extensions),

Zdenek

> Thanks,
> Richard.
> 
> > Thanks,
> > Razya
> >
> > ChangeLog:
> >
> >   PR tree-optimization/49471
> >   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to
> >   ignore reduction variables when iterating the loop header's phis.
> >
> >
> >

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-30 21:56   ` Zdenek Dvorak
@ 2011-07-31 10:45     ` Richard Guenther
  2011-07-31 15:16       ` Zdenek Dvorak
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Guenther @ 2011-07-31 10:45 UTC (permalink / raw)
  To: Zdenek Dvorak; +Cc: Razya Ladelsky, gcc-patches, Sebastian Pop

2011/7/30 Zdenek Dvorak <rakdver@kam.mff.cuni.cz>:
> Hi,
>
>> > This patch fixes the build failure of cactusADM and dealII spec2006
>> > benchmarks when autopar is enabled.
>> > (for powerpc they fail only when -m32 is additionally enabled)
>> >
>> > The problem originated in canonicalize_loop_ivs, where we iterate the
>> > header's phis in order to base all
>> > the induction variables on a single control variable.
>> > We use the largest precision of the loop's ivs in order to determine the
>> > type of the control variable.
>> >
>> > Since iterating the loop's phis takes into account not only the loop's
>> > ivs, but also reduction variables,
>> > we got precision values like 80 for x86, or 128 for ppc.
>> > The compilers failed to create proper types for these sizes
>> > (respectively).
>> >
>> > The proper behavior for determining the control variable's type is to take
>> > into account only the loop's ivs,
>> > which is what this patch does.
>> >
>> > Bootstrap and testsuite pass successfully (as autopar is not enabled by
>> > default).
>> > No new regressions when the testsuite is run with autopar enabled.
>> > No new regressions for the run of spec2006 with autopar enabled,
>> >
>> > cactusADM and dealII benchmarks now pass successfully with autopar on
>> > powerpc and x86.
>> >
>> > Thanks to Zdenek who helped me figure out the failure/fix.
>> > OK for trunk?
>>
>> It'll collide with Sebastians patch in that area.  I suggested a
>> INTEGRAL_TYPE_P check instead of the simple_iv one, it
>> should be cheaper.  Zdenek, do you think it will be "incorrect"
>> in some cases?
>
> well, it does not make much sense -- reductions of integral type would
> be taken into consideration for determining the size of the canonical
> variable.  However, it is not a big issue (the choice of the type is more
> or less arbitrary, as long as the number of iterations fits into it; selecting
> the type based on another existing iv is just to avoid unnecessary extensions),

Hm, ok.  Shouldn't we then simply choose a signed type that can hold
niter based on the fact that we know this IV won't overflow?  Choosing
the biggest of all IVs precision looks indeed odd if we just need to count
from zero to niter.

Richard.

> Zdenek
>
>> Thanks,
>> Richard.
>>
>> > Thanks,
>> > Razya
>> >
>> > ChangeLog:
>> >
>> >   PR tree-optimization/49471
>> >   * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to
>> >   ignore reduction variables when iterating the loop header's phis.
>> >
>> >
>> >
>

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

* Re: [patch] Fix PR tree-optimization/49471
  2011-07-31 10:45     ` Richard Guenther
@ 2011-07-31 15:16       ` Zdenek Dvorak
  0 siblings, 0 replies; 10+ messages in thread
From: Zdenek Dvorak @ 2011-07-31 15:16 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Razya Ladelsky, gcc-patches, Sebastian Pop

Hi,

> >> It'll collide with Sebastians patch in that area.  I suggested a
> >> INTEGRAL_TYPE_P check instead of the simple_iv one, it
> >> should be cheaper.  Zdenek, do you think it will be "incorrect"
> >> in some cases?
> >
> > well, it does not make much sense -- reductions of integral type would
> > be taken into consideration for determining the size of the canonical
> > variable.  However, it is not a big issue (the choice of the type is more
> > or less arbitrary, as long as the number of iterations fits into it; selecting
> > the type based on another existing iv is just to avoid unnecessary extensions),
> 
> Hm, ok.  Shouldn't we then simply choose a signed type that can hold
> niter based on the fact that we know this IV won't overflow?  Choosing
> the biggest of all IVs precision looks indeed odd if we just need to count
> from zero to niter.

we often cannot use a signed type (as long as the initial value is zero),
since we could not guarantee that it will not overflow (if the number of iterations
is more than half of the range of the type),

Zdenek

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

* Re: [patch] Fix PR tree-optimization/49471
       [not found] <OFF30BDBA7.EDA96197-ONC22578D8.004A758E-C22578D8.0050EFC9@LocalDomain>
@ 2011-07-25 15:16 ` Razya Ladelsky
  0 siblings, 0 replies; 10+ messages in thread
From: Razya Ladelsky @ 2011-07-25 15:16 UTC (permalink / raw)
  To: Razya Ladelsky; +Cc: gcc-patches, Zdenek Dvorak, Richard Guenther

Razya Ladelsky/Haifa/IBM wrote on 25/07/2011 05:44:02 PM:

> From: Razya Ladelsky/Haifa/IBM
> To: gcc-patches@gcc.gnu.org
> Cc: Zdenek Dvorak <rakdver@kam.mff.cuni.cz>, Richard Guenther 
> <richard.guenther@gmail.com>
> Date: 25/07/2011 05:44 PM
> Subject: [patch] Fix PR tree-optimization/49471
> 
> Hi,
> 
> This patch fixes the build failure of cactusADM and dealII spec2006 
> benchmarks when autopar is enabled.
> (for powerpc they fail only when -m32 is additionally enabled)
> 
> The problem originated in canonicalize_loop_ivs, where we iterate 
> the header's phis in order to base all
> the induction variables on a single control variable.
> We use the largest precision of the loop's ivs in order to determine
> the type of the control variable. 
> 
> Since iterating the loop's phis takes into account not only the 
> loop's ivs, but also reduction variables, 
> we got precision values like 80 for x86, or 128 for ppc.
> The compilers failed to create proper types for these sizes 
(respectively).
> 
> The proper behavior for determining the control variable's type is 
> to take into account only the loop's ivs,
> which is what this patch does. 
> 
> Bootstrap and testsuite pass successfully (as autopar is not enabled
> by default).
> No new regressions when the testsuite is run with autopar enabled.
> No new regressions for the run of spec2006 with autopar enabled, 
> 
> cactusADM and dealII benchmarks now pass successfully with autopar 
> on powerpc and x86.
> 
> Thanks to Zdenek who helped me figure out the failure/fix. 
> OK for trunk? 
> Thanks,
> Razya
> 
> ChangeLog:
> 
>    PR tree-optimization/49471
>    * tree-vect-loop-manip.c (canonicalize_loop_ivs): Add condition to 
>    ignore reduction variables when iterating the loop header's phis.

I have an error in the ChangeLog:
the change is in tree-ssa-loop-manip.c instead of tree-vect-loop-manip.c 

Sorry,
Razya
> 
> [attachment "cactus_dealII_patch.txt" deleted by Razya 
Ladelsky/Haifa/IBM] 

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

end of thread, other threads:[~2011-07-31 10:45 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-25 14:59 [patch] Fix PR tree-optimization/49471 Razya Ladelsky
2011-07-25 15:02 ` Richard Guenther
2011-07-26 13:53   ` Razya Ladelsky
2011-07-26 14:07     ` Richard Guenther
2011-07-26 18:27       ` Sebastian Pop
2011-07-27  9:41         ` Richard Guenther
2011-07-30 21:56   ` Zdenek Dvorak
2011-07-31 10:45     ` Richard Guenther
2011-07-31 15:16       ` Zdenek Dvorak
     [not found] <OFF30BDBA7.EDA96197-ONC22578D8.004A758E-C22578D8.0050EFC9@LocalDomain>
2011-07-25 15:16 ` Razya Ladelsky

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