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/18179 and use get_inner_reference in vectorizer: part 2







Richard Henderson <rth@redhat.com> wrote on 16/12/2004 10:19:13:

> On Tue, Dec 14, 2004 at 08:54:48AM +0200, Ira Rosen wrote:
> > +   /* Stop conditions:
> > +      1. Constant.  */
> > +   if (host_integerp (expr, 1))
>
> You want TREE_CONSTANT, surely.
>
On second thought, I'm afraid this may be not restrictive enough. As
far as I understand, TREE_CONSTANT includes also expressions and
declarations, which value is unknown in compile time, but it is
invariant in the program, right?

If so, TREE_CONSTANT is not enough in our case, since we really need
a number here. This is because we currently don't have any
special treatment for the case that the alignment is unknown yet
doesn't change. For this reason during the computation of the
alignment we don't bother building expressions that represent the
alignment if they are going to end up being unknown anyway; we keep
on representing the alignment as long as there's a chance to prove
that it is definitely aligned or definitely unaligned and by how
much (i.e have a concrete number).

Because of this, in other places in the vectorizer (e.g
vect_compute_data_ref_alignment) we assume that we have a number
there, and may ICE.

There are two ways to handle this:

1) switch to test for _CST nodes only, instead of TREE_CONSTANT:

Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.56
diff -c -3 -p -r2.56 tree-vectorizer.c
*** tree-vectorizer.c   2 Jan 2005 08:35:34 -0000       2.56
--- tree-vectorizer.c   3 Jan 2005 12:52:23 -0000
*************** vect_analyze_offset_expr (tree expr,
*** 1413,1419 ****

    /* Stop conditions:
       1. Constant.  */
!   if (TREE_CONSTANT (expr))
      {
        *initial_offset = fold_convert (sizetype, expr);
        *misalign = fold_convert (sizetype, expr);
--- 1413,1419 ----

    /* Stop conditions:
       1. Constant.  */
!   if (CONSTANT_CLASS_P (expr))
      {
        *initial_offset = fold_convert (sizetype, expr);
        *misalign = fold_convert (sizetype, expr);

2) continue to use TREE_CONSTANT (in case in the future we'll find a
way to exploit the information that an alignment is unknown but is
always the same) and add a check for _CST nodes in
vect_compute_data_ref_alignment:

Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.56
diff -c -3 -p -r2.56 tree-vectorizer.c
*** tree-vectorizer.c   2 Jan 2005 08:35:34 -0000       2.56
--- tree-vectorizer.c   3 Jan 2005 12:48:20 -0000
*************** vect_compute_data_ref_alignment (struct
*** 4141,4147 ****
    base = STMT_VINFO_VECT_DR_BASE (stmt_info);
    vectype = STMT_VINFO_VECTYPE (stmt_info);

!   if (!misalign)
      {
        if (vect_debug_details (NULL))
        {
--- 4141,4147 ----
    base = STMT_VINFO_VECT_DR_BASE (stmt_info);
    vectype = STMT_VINFO_VECTYPE (stmt_info);

!   if (!misalign || !CONSTANT_CLASS_P (misalign))
      {
        if (vect_debug_details (NULL))
        {

There are also other occurrences of TREE_CONSTANT with the similar problem,
therefore, the second solution will require looking for all the potential
ICE situations.

Thanks,
Ira


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