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: PR18173 [patch]





> ... this is the wrong check.  Use TREE_ASM_WRITTEN.

Thanks.

Here's the revised patch to fix PR18173 by not attempting to force
alignment of decls that are assembled before vectorization. Bootstrapped
and tested on powerpc-darwin, i686-pc-linux-gnu and powerpc-suse-linux.

ok for mainline?

thanks,

dorit


Changelog:

        * tree-vectorizer.c (vect_can_force_dr_alignment_p): Return false
for
        decls that are assembled before vectorization takes place.
        (vect_compute_data_ref_alignment): Set DECL_USER_ALIGN to 1.

Patch:

Index: tree-vectorizer.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-vectorizer.c,v
retrieving revision 2.42
diff -c -3 -p -r2.42 tree-vectorizer.c
*** tree-vectorizer.c   25 Nov 2004 22:31:09 -0000      2.42
--- tree-vectorizer.c   29 Nov 2004 08:33:48 -0000
*************** vect_can_force_dr_alignment_p (tree decl
*** 1509,1514 ****
--- 1509,1517 ----
    if (DECL_EXTERNAL (decl))
      return false;

+   if (TREE_ASM_WRITTEN (decl))
+     return false;
+
    if (TREE_STATIC (decl))
      return (alignment <= MAX_OFILE_ALIGNMENT);
    else
*************** vect_compute_data_ref_alignment (struct
*** 4130,4136 ****
        if (vect_debug_details (NULL))
        fprintf (dump_file, "force alignment");
        DECL_ALIGN (base) = TYPE_ALIGN (vectype);
!       DECL_USER_ALIGN (base) = TYPE_ALIGN (vectype);
      }

    /* At this point we assume that the base is aligned, and the offset
from it
--- 4133,4139 ----
        if (vect_debug_details (NULL))
        fprintf (dump_file, "force alignment");
        DECL_ALIGN (base) = TYPE_ALIGN (vectype);
!       DECL_USER_ALIGN (base) = 1;
      }

    /* At this point we assume that the base is aligned, and the offset
from it





                                                                                                                                  
                      Richard Henderson                                                                                           
                      <rth@redhat.com>         To:       Dorit Naishlos/Haifa/IBM@IBMIL                                           
                                               cc:       gcc-patches@gcc.gnu.org, Geoffrey Keating <geoffk@geoffk.org>            
                      28/11/2004 23:58         Subject:  Re: PR18173 - can't force alignment of global arrays with static         
                                                initializer?                                                                      
                                                                                                                                  




On Sun, Nov 28, 2004 at 08:01:37PM +0200, Dorit Naishlos wrote:
> The reason why the vectorizer can't force the alignment of global arrays
> with static initialization is that they are being assembled before
> vectorization:

If that's the case...

> +   if (DECL_FILE_SCOPE_P (decl) && DECL_INITIAL (decl))
> +     return false;

... this is the wrong check.  Use TREE_ASM_WRITTEN.


r~



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