This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix PR tree-optimization/46167


On Tue, Oct 26, 2010 at 3:34 PM, Ira Rosen <IRAR@il.ibm.com> wrote:
>
>
> Richard Guenther <richard.guenther@gmail.com> wrote on 26/10/2010 09:12:50
> PM:
>
>> On Tue, Oct 26, 2010 at 11:53 AM, Ira Rosen <IRAR@il.ibm.com> wrote:
>> >
>> > Hi,
>> >
>> > This patch adds a check that a basic block exists before calling
>> > flow_bb_inside_loop_p.
>> >
>> > Bootstrapped and tested on x86_64-suse-linux.
>> > Committed to trunk.
>> >
>> > Now testing the patch for 4.5 on x86_64-suse-linux. OK for 4.5 once the
>> > testing completes?
>>
>> Why is the stmt not in any BB?
>
> It's a function argument.

You mean it's the defining statement for a parameter SSA name?  In that
case, yes, the patch is ok for backporting

Thanks,
Richard.

> Ira
>
>>
>> Richard.
>>
>> > Thanks,
>> > Ira
>> >
>> > ChangeLog:
>> >
>> > ? ? ? ?PR tree-optimization/46167
>> > ? ? ? ?* tree-vect-patterns.c (vect_recog_dot_prod_pattern): Check that
>> > there
>> > ? ? ? ?is basic block for the statement.
>> >
>> > testsuite/ChangeLog:
>> >
>> > ? ? ? ?PR tree-optimization/46167
>> > ? ? ? ?* gcc.dg/vect/O-pr46167.c: New.
>> > ? ? ? ?* gcc.dg/vect/vect.exp: Run tests with -O.
>> >
>> >
>> > 4.6 patch:
>> >
>> > Index: testsuite/gcc.dg/vect/O-pr46167.c
>> > ===================================================================
>> > --- testsuite/gcc.dg/vect/O-pr46167.c ? (revision 0)
>> > +++ testsuite/gcc.dg/vect/O-pr46167.c ? (revision 0)
>> > @@ -0,0 +1,11 @@
>> > +/* { dg-do compile } */
>> > +
>> > +int foo (char c, int i)
>> > +{
>> > + ?int s = 0;
>> > + ?while (i--)
>> > + ? ?s += c;
>> > + ?return s;
>> > +}
>> > +
>> > +/* { dg-final { cleanup-tree-dump "vect" } } */
>> > Index: testsuite/gcc.dg/vect/vect.exp
>> > ===================================================================
>> > --- testsuite/gcc.dg/vect/vect.exp ? ? ?(revision 165969)
>> > +++ testsuite/gcc.dg/vect/vect.exp ? ? ?(working copy)
>> > @@ -126,6 +126,11 @@ set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
>> > ?lappend O1_VECTCFLAGS "-O1"
>> > ?lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
>> >
>> > +global O_VECTCFLAGS
>> > +set O_VECTCFLAGS $DEFAULT_VECTCFLAGS
>> > +lappend O_VECTCFLAGS "-O"
>> > +lappend O_VECTCFLAGS "-fdump-tree-vect-details"
>> > +
>> > ?lappend DEFAULT_VECTCFLAGS "-O2"
>> >
>> > ?# Tests that should be run without generating dump info
>> > @@ -287,6 +292,10 @@ dg-runtest [lsort [glob -nocomplain $src
>> > ?dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] ?\
>> > ? ? ? ? "" $O1_VECTCFLAGS
>> >
>> > +# With -O
>> > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] ?\
>> > + ? ? ? ?"" $O_VECTCFLAGS
>> > +
>> > ?# -fno-tree-reassoc
>> > ?set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
>> > ?lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
>> > Index: tree-vect-patterns.c
>> > ===================================================================
>> > --- tree-vect-patterns.c ? ? ? ?(revision 165969)
>> > +++ tree-vect-patterns.c ? ? ? ?(working copy)
>> > @@ -257,7 +257,7 @@ vect_recog_dot_prod_pattern (gimple last
>> > ? stmt = SSA_NAME_DEF_STMT (oprnd0);
>> >
>> > ? /* It could not be the dot_prod pattern if the stmt is outside the
> loop.
>> > */
>> > - ?if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
>> > + ?if (!gimple_bb (stmt) || !flow_bb_inside_loop_p (loop, gimple_bb
>> > (stmt)))
>> > ? ? return NULL;
>> >
>> > ? /* FORNOW. ?Can continue analyzing the def-use chain when this stmt
> in a
>> > phi
>> >
>> >
>> > 4.5 patch:
>> >
>> > Index: testsuite/gcc.dg/vect/O-pr46167.c
>> > ===================================================================
>> > --- testsuite/gcc.dg/vect/O-pr46167.c ? (revision 0)
>> > +++ testsuite/gcc.dg/vect/O-pr46167.c ? (revision 0)
>> > @@ -0,0 +1,11 @@
>> > +/* { dg-do compile } */
>> > +
>> > +int foo (char c, int i)
>> > +{
>> > + ?int s = 0;
>> > + ?while (i--)
>> > + ? ?s += c;
>> > + ?return s;
>> > +}
>> > +
>> > +/* { dg-final { cleanup-tree-dump "vect" } } */
>> > Index: testsuite/gcc.dg/vect/vect.exp
>> > ===================================================================
>> > --- testsuite/gcc.dg/vect/vect.exp ? ? ?(revision 165269)
>> > +++ testsuite/gcc.dg/vect/vect.exp ? ? ?(working copy)
>> > @@ -122,6 +122,11 @@ set O1_VECTCFLAGS $DEFAULT_VECTCFLAGS
>> > ?lappend O1_VECTCFLAGS "-O1"
>> > ?lappend O1_VECTCFLAGS "-fdump-tree-vect-details"
>> >
>> > +global O_VECTCFLAGS
>> > +set O_VECTCFLAGS $DEFAULT_VECTCFLAGS
>> > +lappend O_VECTCFLAGS "-O"
>> > +lappend O_VECTCFLAGS "-fdump-tree-vect-details"
>> > +
>> > ?lappend DEFAULT_VECTCFLAGS "-O2"
>> >
>> > ?# Tests that should be run without generating dump info
>> > @@ -283,6 +288,10 @@ dg-runtest [lsort [glob -nocomplain $src
>> > ?dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O1-*.\[cS\]]] ?\
>> > ? ? ? ? "" $O1_VECTCFLAGS
>> >
>> > +# With -O
>> > +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/O-*.\[cS\]]] ?\
>> > + ? ? ? ?"" $O_VECTCFLAGS
>> > +
>> > ?# -fno-tree-reassoc
>> > ?set VECT_SLP_CFLAGS $SAVED_VECT_SLP_CFLAGS
>> > ?lappend VECT_SLP_CFLAGS "-fno-tree-reassoc"
>> > Index: tree-vect-patterns.c
>> > ===================================================================
>> > --- tree-vect-patterns.c ? ? ? ?(revision 165269)
>> > +++ tree-vect-patterns.c ? ? ? ?(working copy)
>> > @@ -256,7 +256,7 @@ vect_recog_dot_prod_pattern (gimple last
>> > ? stmt = SSA_NAME_DEF_STMT (oprnd0);
>> >
>> > ? /* It could not be the dot_prod pattern if the stmt is outside the
> loop.
>> > */
>> > - ?if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt)))
>> > + ?if (!gimple_bb (stmt) || !flow_bb_inside_loop_p (loop, gimple_bb
>> > (stmt)))
>> > ? ? return NULL;
>> >
>> > ? /* FORNOW. ?Can continue analyzing the def-use chain when this stmt
> in a
>> > phi
>> >
>> >
>
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]