This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix scev tuplification bug (PR tree-optimization/37416)
- From: Ira Rosen <IRAR at il dot ibm dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org, Sebastian Pop <sebpop at gmail dot com>
- Date: Wed, 10 Dec 2008 12:05:32 +0200
- Subject: Re: [PATCH] Fix scev tuplification bug (PR tree-optimization/37416)
Jakub Jelinek <jakub@redhat.com> wrote on 10/12/2008 00:19:42:
> Hi!
>
> Tuplification resulted in some loops to have unknown number of iterations
> computed. The problem is that follow_ssa_edge_in_rhs before
tuplification
> handled NOP_EXPR, but as it is GIMPLE_UNARY_RHS, it doesn't handle it
> anymore.
>
> Fixed thusly, bootstrapped/regtested on x86_64-linux and tested that
> on the testcase from PR in vect dump symbolic number of iterations is
> printed again as in 4.3 and the loop is vectorized.
Thanks!
> I'd appreciate some
> help with the testcase for this (in which dump to look at, on which
arches
> to run the test (e.g. if short is as wide as int, I'm not sure if it
should
> pass, etc.).
This testcase is already in the testsuite: gcc.dg/vect/pr36630.c. Currently
it doesn't check that the loop gets vectorized. So, I think that adding
such check, will do the job:
Index: testsuite/gcc.dg/vect/pr36630.c
===================================================================
--- testsuite/gcc.dg/vect/pr36630.c (revision 142638)
+++ testsuite/gcc.dg/vect/pr36630.c (working copy)
@@ -13,4 +13,6 @@ foo (unsigned char *x, short y)
i = i + 1;
}
}
+}
+/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" } } */
/* { dg-final { cleanup-tree-dump "vect" } } */
I don't know about the architectures to test the patch on. I ran the
vectorizer testsuite with your patch on powerpc64-suse-linux.
Thanks,
Ira
>
> Ok for trunk?
>
> 2008-12-09 Jakub Jelinek <jakub@redhat.com>
>
> PR tree-optimization/37416
> * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Handle NOP_EXPR.
>
> --- gcc/tree-scalar-evolution.c.jj 2008-11-10 10:28:26.000000000 +0100
> +++ gcc/tree-scalar-evolution.c 2008-12-09 21:17:10.000000000 +0100
> @@ -1229,6 +1229,18 @@ follow_ssa_edge_in_rhs (struct loop *loo
> case GIMPLE_SINGLE_RHS:
> return follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1
(stmt),
> halting_phi, evolution_of_loop, limit);
> + case GIMPLE_UNARY_RHS:
> + if (code == NOP_EXPR)
> + {
> + /* This assignment is under the form "a_1 = (cast) rhs. */
> + t_bool res
> + = follow_ssa_edge_expr (loop, stmt, gimple_assign_rhs1 (stmt),
> + halting_phi, evolution_of_loop, limit);
> + *evolution_of_loop = chrec_convert (type, *evolution_of_loop,
stmt);
> + return res;
> + }
> + /* FALLTHRU */
> +
> default:
> return t_false;
> }
>
> Jakub