The change also affects vectorizer in avx case which could be seen for
gcc.dg/tree-ssa/loop-19.c test.

After the change report says

loop-19_bad.c:16: note: === vect_analyze_data_refs_alignment ===
loop-19_bad.c:16: note: vect_compute_data_ref_alignment:
loop-19_bad.c:16: note: can't force alignment of ref: a[j_9]
loop-19_bad.c:16: note: vect_compute_data_ref_alignment:
loop-19_bad.c:16: note: can't force alignment of ref: c[j_9]

AFAICS first condition in ix86_data_alignment was true before the
change so 256 was a return value.

Do we need to tweak this test also?

Thanks,
Igor

> Hi!
>
> This PR is about DATA_ALIGNMENT macro increasing alignment of some decls for 
> optimization purposes beyond ABI mandated levels.  It is fine to emit the 
> vars aligned as much as we want for optimization purposes, but if we can't be 
> sure that references to that decl bind to the definition we increased the 
> alignment on (e.g. common variables, or -fpic code without hidden visibility, 
> weak vars etc.), we can't assume that alignment.
> As DECL_ALIGN is used for both the alignment emitted for the definitions and 
> alignment assumed on code referring to it, this patch increases DECL_ALIGN 
> only on decls where decl_binds_to_current_def_p is true, and otherwise the 
> optimization part on top of that emits only when aligning definition.
> On x86_64, DATA_ALIGNMENT macro was partly an optimization, partly ABI 
> mandated alignment increase, so I've introduced a new macro, 
> DATA_ABI_ALIGNMENT, which is the ABI mandated increase only (on x86-64 I 
> think the only one is that arrays with size 16 bytes or more (and VLAs, but 
> that is not handled by DATA*ALIGNMENT) are at least 16 byte aligned).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux.  No idea about other 
> targets, I've kept them all using DATA_ALIGNMENT, which is considered 
> optimization increase only now, if there is some ABI mandated alignment 
> increase on other targets, that should be done in DATA_ABI_ALIGNMENT as well 
> as DATA_ALIGNMENT.  The patch causes some vectorization regressions (tweaked 
> in the testsuite), especially for common vars where we used to align say 
> common arrays to 256 bits rather than the ABI mandated 128 bits, or for -fpic 
> code, but I'm afraid we need to live with that, if you compile another file 
> with say icc or some other compiler which doesn't increase alignment beyond 
> ABI mandated level and that other file defines the var say as non-common, we 
> have wrong-code.
>
> 2013-06-07  Jakub Jelinek  <ja...@redhat.com>
>
>         PR target/56564
>         * varasm.c (align_variable): Don't use DATA_ALIGNMENT or
>         CONSTANT_ALIGNMENT if !decl_binds_to_current_def_p (decl).
>         Use DATA_ABI_ALIGNMENT for that case instead if defined.
>         (get_variable_align): New function.
>         (get_variable_section, emit_bss, emit_common,
>         assemble_variable_contents, place_block_symbol): Use
>         get_variable_align instead of DECL_ALIGN.
>         (assemble_noswitch_variable): Add align argument, use it
>         instead of DECL_ALIGN.
>         (assemble_variable): Adjust caller.  Use get_variable_align
>         instead of DECL_ALIGN.
>         * config/i386/i386.h (DATA_ALIGNMENT): Adjust x86_data_alignment
>         caller.
>         (DATA_ABI_ALIGNMENT): Define.
>         * config/i386/i386-protos.h (x86_data_alignment): Adjust prototype.
>         * config/i386/i386.c (x86_data_alignment): Add opt argument.  If
>         opt is false, only return the psABI mandated alignment increase.
>         * doc/tm.texi.in (DATA_ABI_ALIGNMENT): Document.
>         * doc/tm.texi: Regenerated.
>
>         * gcc.target/i386/pr56564-1.c: New test.
>         * gcc.target/i386/pr56564-2.c: New test.
>         * gcc.target/i386/pr56564-3.c: New test.
>         * gcc.target/i386/pr56564-4.c: New test.
>         * gcc.target/i386/avx256-unaligned-load-4.c: Add -fno-common.
>         * gcc.target/i386/avx256-unaligned-store-1.c: Likewise.
>         * gcc.target/i386/avx256-unaligned-store-3.c: Likewise.
>         * gcc.target/i386/avx256-unaligned-store-4.c: Likewise.
>         * gcc.target/i386/vect-sizes-1.c: Likewise.
>         * gcc.target/i386/memcpy-1.c: Likewise.
>         * gcc.dg/vect/costmodel/i386/costmodel-vect-31.c (tmp): Initialize.
>         * gcc.dg/vect/costmodel/x86_64/costmodel-vect-31.c (tmp): Likewise.
>

Reply via email to