https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114566

--- Comment #12 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The user align:32 MEM_REF comes from
(gdb) p debug (dr_info->dr)
#(Data Ref: 
#  bb: 21 
#  stmt: a[j_38][k_41] = _48;
#  ref: a[j_38][k_41];
#  base_object: a;
#  Access function 0: {0, +, 1}_3
#  Access function 1: j_38
#)
$34 = void
(gdb) p *dr_info
$35 = {dr = 0x3a1be60, stmt = 0x3a1ef10, group = 21, misalignment = -1,
target_alignment = {<poly_int_pod<1, unsigned long>> = {coeffs = {64}}, <No
data fields>}, 
  base_misaligned = false, base_decl = <tree 0x0>, offset = <tree 0x0>}
(gdb) p *dr_info->dr
$36 = {stmt = <gimple_assign 0x7fffea04e320>, ref = <array_ref 0x7fffea139bd0>,
aux = 0x0, is_read = false, is_conditional_in_stmt = false, alias = {ptr_info =
0x0}, innermost = {
    base_address = <addr_expr 0x7fffea051160>, offset = <nop_expr
0x7fffea051180>, init = <integer_cst 0x7fffea0474f8>, step = <integer_cst
0x7fffea047528>, base_alignment = 16, 
    base_misalignment = 0, offset_alignment = 32, step_alignment = 4}, indices
= {base_object = <mem_ref 0x7fffea058ac8>, access_fns = {m_vec = 0x383ebb0 =
{0x7fffea058618, 
        0x7fffea03fdc8}}, unconstrained_base = false}, alt_indices =
{base_object = <tree 0x0>, access_fns = {m_vec = 0x0}, unconstrained_base =
false}}
dr in vectorizable_store, alignment_support_scheme is dr_unaligned_supported
and so build_aligned_type is done:
8694                      data_ref = fold_build2 (MEM_REF, vectype,
8695                                              dataref_ptr,
8696                                              dataref_offset
8697                                              ? dataref_offset
8698                                              : build_int_cst (ref_type,
0));
8699                      if (alignment_support_scheme == dr_aligned)
8700                        ;
8701                      else
8702                        TREE_TYPE (data_ref)
8703                          = build_aligned_type (TREE_TYPE (data_ref),
8704                                                align * BITS_PER_UNIT);
while the incorrect one is
(gdb) p debug (dr_info->dr)
#(Data Ref: 
#  bb: 51 
#  stmt: a[j_38][k_63] = _33;
#  ref: a[j_38][k_41];
#  base_object: a;
#  Access function 0: {0, +, 1}_3
#  Access function 1: j_38
#)
$37 = void
(gdb) p *dr_info
$38 = {dr = 0x3a1be60, stmt = 0x3a21f20, group = 21, misalignment = 0,
target_alignment = {<poly_int_pod<1, unsigned long>> = {coeffs = {32}}, <No
data fields>}, 
  base_misaligned = false, base_decl = <var_decl 0x7fffea13bcf0 a>, offset =
<integer_cst 0x7fffea0477e0>}
(gdb) p *dr_info->dr
$39 = {stmt = <gimple_assign 0x7fffea04e9b0>, ref = <array_ref 0x7fffea139bd0>,
aux = 0x0, is_read = false, is_conditional_in_stmt = false, alias = {ptr_info =
0x0}, innermost = {
    base_address = <addr_expr 0x7fffea051160>, offset = <nop_expr
0x7fffea051180>, init = <integer_cst 0x7fffea0474f8>, step = <integer_cst
0x7fffea047528>, base_alignment = 16, 
    base_misalignment = 0, offset_alignment = 32, step_alignment = 4}, indices
= {base_object = <mem_ref 0x7fffea058ac8>, access_fns = {m_vec = 0x383ebb0 =
{0x7fffea058618, 
        0x7fffea03fdc8}}, unconstrained_base = false}, alt_indices =
{base_object = <tree 0x0>, access_fns = {m_vec = 0x0}, unconstrained_base =
false}}

base_alignment in both cases is 16, so I wonder why it would think that
V8SFmode access on it is aligned.
Ah, the first case is actually with V16SFmode access, perhaps something
considers just the offset_alignment which is good enough for 32-byte alignment
but not 64-byte alignment and disregards base_alignment?

Reply via email to