Skip to content

Commit aec313e

Browse files
author
rsandifo
committed
Let the target choose a vectorisation alignment
The vectoriser aligned vectors to TYPE_ALIGN unconditionally, although there was also a hard-coded assumption that this was equal to the type size. This was inconvenient for SVE for two reasons: - When compiling for a specific power-of-2 SVE vector length, we might want to align to a full vector. However, the TYPE_ALIGN is governed by the ABI alignment, which is 128 bits regardless of size. - For vector-length-agnostic code it doesn't usually make sense to align, since the runtime vector length might not be a power of two. Even for power of two sizes, there's no guarantee that aligning to the previous 16 bytes will be an improveent. This patch therefore adds a target hook to control the preferred vectoriser (as opposed to ABI) alignment. 2017-09-22 Richard Sandiford <richard.sandiford@linaro.org> Alan Hayward <alan.hayward@arm.com> David Sherwood <david.sherwood@arm.com> gcc/ * target.def (preferred_vector_alignment): New hook. * doc/tm.texi.in (TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT): New hook. * doc/tm.texi: Regenerate. * targhooks.h (default_preferred_vector_alignment): Declare. * targhooks.c (default_preferred_vector_alignment): New function. * tree-vectorizer.h (dataref_aux): Add a target_alignment field. Expand commentary. (DR_TARGET_ALIGNMENT): New macro. (aligned_access_p): Update commentary. (vect_known_alignment_in_bytes): New function. * tree-vect-data-refs.c (vect_calculate_required_alignment): New function. (vect_compute_data_ref_alignment): Set DR_TARGET_ALIGNMENT. Calculate the misalignment based on the target alignment rather than the vector size. (vect_update_misalignment_for_peel): Use DR_TARGET_ALIGMENT rather than TYPE_ALIGN / BITS_PER_UNIT to update the misalignment. (vect_enhance_data_refs_alignment): Mask the byte misalignment with the target alignment, rather than masking the element misalignment with the number of elements in a vector. Also use the target alignment when calculating the maximum number of peels. (vect_find_same_alignment_drs): Use vect_calculate_required_alignment instead of TYPE_ALIGN_UNIT. (vect_duplicate_ssa_name_ptr_info): Remove stmt_info parameter. Measure DR_MISALIGNMENT relative to DR_TARGET_ALIGNMENT. (vect_create_addr_base_for_vector_ref): Update call accordingly. (vect_create_data_ref_ptr): Likewise. (vect_setup_realignment): Realign by ANDing with -DR_TARGET_MISALIGNMENT. * tree-vect-loop-manip.c (vect_gen_prolog_loop_niters): Calculate the number of peels based on DR_TARGET_ALIGNMENT. * tree-vect-stmts.c (get_group_load_store_type): Compare the gap with the guaranteed alignment boundary when deciding whether overrun is OK. (vectorizable_mask_load_store): Interpret DR_MISALIGNMENT relative to DR_TARGET_ALIGNMENT instead of TYPE_ALIGN_UNIT. (ensure_base_align): Remove stmt_info parameter. Get the target base alignment from DR_TARGET_ALIGNMENT. (vectorizable_store): Update call accordingly. Interpret DR_MISALIGNMENT relative to DR_TARGET_ALIGNMENT instead of TYPE_ALIGN_UNIT. (vectorizable_load): Likewise. gcc/testsuite/ * gcc.dg/vect/vect-outer-3a.c: Adjust dump scan for new wording of alignment message. * gcc.dg/vect/vect-outer-3a-big-array.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@253101 138bc75d-0d04-0410-961f-82ee72b054a4
1 parent 10ab99d commit aec313e

13 files changed

+242
-105
lines changed

gcc/ChangeLog

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,51 @@
1+
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
2+
Alan Hayward <alan.hayward@arm.com>
3+
David Sherwood <david.sherwood@arm.com>
4+
5+
* target.def (preferred_vector_alignment): New hook.
6+
* doc/tm.texi.in (TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT): New
7+
hook.
8+
* doc/tm.texi: Regenerate.
9+
* targhooks.h (default_preferred_vector_alignment): Declare.
10+
* targhooks.c (default_preferred_vector_alignment): New function.
11+
* tree-vectorizer.h (dataref_aux): Add a target_alignment field.
12+
Expand commentary.
13+
(DR_TARGET_ALIGNMENT): New macro.
14+
(aligned_access_p): Update commentary.
15+
(vect_known_alignment_in_bytes): New function.
16+
* tree-vect-data-refs.c (vect_calculate_required_alignment): New
17+
function.
18+
(vect_compute_data_ref_alignment): Set DR_TARGET_ALIGNMENT.
19+
Calculate the misalignment based on the target alignment rather than
20+
the vector size.
21+
(vect_update_misalignment_for_peel): Use DR_TARGET_ALIGMENT
22+
rather than TYPE_ALIGN / BITS_PER_UNIT to update the misalignment.
23+
(vect_enhance_data_refs_alignment): Mask the byte misalignment with
24+
the target alignment, rather than masking the element misalignment
25+
with the number of elements in a vector. Also use the target
26+
alignment when calculating the maximum number of peels.
27+
(vect_find_same_alignment_drs): Use vect_calculate_required_alignment
28+
instead of TYPE_ALIGN_UNIT.
29+
(vect_duplicate_ssa_name_ptr_info): Remove stmt_info parameter.
30+
Measure DR_MISALIGNMENT relative to DR_TARGET_ALIGNMENT.
31+
(vect_create_addr_base_for_vector_ref): Update call accordingly.
32+
(vect_create_data_ref_ptr): Likewise.
33+
(vect_setup_realignment): Realign by ANDing with
34+
-DR_TARGET_MISALIGNMENT.
35+
* tree-vect-loop-manip.c (vect_gen_prolog_loop_niters): Calculate
36+
the number of peels based on DR_TARGET_ALIGNMENT.
37+
* tree-vect-stmts.c (get_group_load_store_type): Compare the gap
38+
with the guaranteed alignment boundary when deciding whether
39+
overrun is OK.
40+
(vectorizable_mask_load_store): Interpret DR_MISALIGNMENT
41+
relative to DR_TARGET_ALIGNMENT instead of TYPE_ALIGN_UNIT.
42+
(ensure_base_align): Remove stmt_info parameter. Get the
43+
target base alignment from DR_TARGET_ALIGNMENT.
44+
(vectorizable_store): Update call accordingly. Interpret
45+
DR_MISALIGNMENT relative to DR_TARGET_ALIGNMENT instead of
46+
TYPE_ALIGN_UNIT.
47+
(vectorizable_load): Likewise.
48+
149
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
250
Alan Hayward <alan.hayward@arm.com>
351
David Sherwood <david.sherwood@arm.com>

gcc/doc/tm.texi

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5758,6 +5758,18 @@ For vector memory operations the cost may depend on type (@var{vectype}) and
57585758
misalignment value (@var{misalign}).
57595759
@end deftypefn
57605760

5761+
@deftypefn {Target Hook} HOST_WIDE_INT TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT (const_tree @var{type})
5762+
This hook returns the preferred alignment in bits for accesses to
5763+
vectors of type @var{type} in vectorized code. This might be less than
5764+
or greater than the ABI-defined value returned by
5765+
@code{TARGET_VECTOR_ALIGNMENT}. It can be equal to the alignment of
5766+
a single element, in which case the vectorizer will not try to optimize
5767+
for alignment.
5768+
5769+
The default hook returns @code{TYPE_ALIGN (@var{type})}, which is
5770+
correct for most targets.
5771+
@end deftypefn
5772+
57615773
@deftypefn {Target Hook} bool TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE (const_tree @var{type}, bool @var{is_packed})
57625774
Return true if vector alignment is reachable (by peeling N iterations) for the given scalar type @var{type}. @var{is_packed} is false if the scalar access using @var{type} is known to be naturally aligned.
57635775
@end deftypefn

gcc/doc/tm.texi.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4088,6 +4088,8 @@ address; but often a machine-dependent strategy can generate better code.
40884088

40894089
@hook TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST
40904090

4091+
@hook TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT
4092+
40914093
@hook TARGET_VECTORIZE_VECTOR_ALIGNMENT_REACHABLE
40924094

40934095
@hook TARGET_VECTORIZE_VEC_PERM_CONST_OK

gcc/target.def

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1820,6 +1820,20 @@ misalignment value (@var{misalign}).",
18201820
int, (enum vect_cost_for_stmt type_of_cost, tree vectype, int misalign),
18211821
default_builtin_vectorization_cost)
18221822

1823+
DEFHOOK
1824+
(preferred_vector_alignment,
1825+
"This hook returns the preferred alignment in bits for accesses to\n\
1826+
vectors of type @var{type} in vectorized code. This might be less than\n\
1827+
or greater than the ABI-defined value returned by\n\
1828+
@code{TARGET_VECTOR_ALIGNMENT}. It can be equal to the alignment of\n\
1829+
a single element, in which case the vectorizer will not try to optimize\n\
1830+
for alignment.\n\
1831+
\n\
1832+
The default hook returns @code{TYPE_ALIGN (@var{type})}, which is\n\
1833+
correct for most targets.",
1834+
HOST_WIDE_INT, (const_tree type),
1835+
default_preferred_vector_alignment)
1836+
18231837
/* Return true if vector alignment is reachable (by peeling N
18241838
iterations) for the given scalar type. */
18251839
DEFHOOK

gcc/targhooks.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,6 +1175,15 @@ default_vector_alignment (const_tree type)
11751175
return align;
11761176
}
11771177

1178+
/* The default implementation of
1179+
TARGET_VECTORIZE_PREFERRED_VECTOR_ALIGNMENT. */
1180+
1181+
HOST_WIDE_INT
1182+
default_preferred_vector_alignment (const_tree type)
1183+
{
1184+
return TYPE_ALIGN (type);
1185+
}
1186+
11781187
/* By default assume vectors of element TYPE require a multiple of the natural
11791188
alignment of TYPE. TYPE is naturally aligned if IS_PACKED is false. */
11801189
bool

gcc/targhooks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ extern tree default_builtin_reciprocal (tree);
9595

9696
extern HOST_WIDE_INT default_vector_alignment (const_tree);
9797

98+
extern HOST_WIDE_INT default_preferred_vector_alignment (const_tree);
9899
extern bool default_builtin_vector_alignment_reachable (const_tree, bool);
99100
extern bool
100101
default_builtin_support_vector_misalignment (machine_mode mode,

gcc/testsuite/ChangeLog

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
2017-09-22 Richard Sandiford <richard.sandiford@linaro.org>
2+
Alan Hayward <alan.hayward@arm.com>
3+
David Sherwood <david.sherwood@arm.com>
4+
5+
* gcc.dg/vect/vect-outer-3a.c: Adjust dump scan for new wording
6+
of alignment message.
7+
* gcc.dg/vect/vect-outer-3a-big-array.c: Likewise.
8+
19
2017-09-22 Martin Sebor <msebor@redhat.com>
210

311
PR c/81854

gcc/testsuite/gcc.dg/vect/vect-outer-3a-big-array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ int main (void)
4949
}
5050

5151
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
52-
/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 1 "vect" } } */
52+
/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" } } */

gcc/testsuite/gcc.dg/vect/vect-outer-3a.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ int main (void)
4949
}
5050

5151
/* { dg-final { scan-tree-dump-times "OUTER LOOP VECTORIZED" 1 "vect" { xfail { vect_no_align && { ! vect_hw_misalign } } } } } */
52-
/* { dg-final { scan-tree-dump-times "step doesn't divide the vector-size" 1 "vect" } } */
52+
/* { dg-final { scan-tree-dump-times "step doesn't divide the vector alignment" 1 "vect" } } */

gcc/tree-vect-data-refs.c

Lines changed: 52 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -775,6 +775,17 @@ vect_record_base_alignments (vec_info *vinfo)
775775
}
776776
}
777777

778+
/* Return the target alignment for the vectorized form of DR. */
779+
780+
static unsigned int
781+
vect_calculate_target_alignment (struct data_reference *dr)
782+
{
783+
gimple *stmt = DR_STMT (dr);
784+
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
785+
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
786+
return targetm.vectorize.preferred_vector_alignment (vectype);
787+
}
788+
778789
/* Function vect_compute_data_ref_alignment
779790
780791
Compute the misalignment of the data reference DR.
@@ -811,6 +822,10 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
811822
innermost_loop_behavior *drb = vect_dr_behavior (dr);
812823
bool step_preserves_misalignment_p;
813824

825+
unsigned HOST_WIDE_INT vector_alignment
826+
= vect_calculate_target_alignment (dr) / BITS_PER_UNIT;
827+
DR_TARGET_ALIGNMENT (dr) = vector_alignment;
828+
814829
/* No step for BB vectorization. */
815830
if (!loop)
816831
{
@@ -823,43 +838,41 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
823838
relative to the outer-loop (LOOP). This is ok only if the misalignment
824839
stays the same throughout the execution of the inner-loop, which is why
825840
we have to check that the stride of the dataref in the inner-loop evenly
826-
divides by the vector size. */
841+
divides by the vector alignment. */
827842
else if (nested_in_vect_loop_p (loop, stmt))
828843
{
829844
step_preserves_misalignment_p
830-
= (DR_STEP_ALIGNMENT (dr)
831-
% GET_MODE_SIZE (TYPE_MODE (vectype))) == 0;
845+
= (DR_STEP_ALIGNMENT (dr) % vector_alignment) == 0;
832846

833847
if (dump_enabled_p ())
834848
{
835849
if (step_preserves_misalignment_p)
836850
dump_printf_loc (MSG_NOTE, vect_location,
837-
"inner step divides the vector-size.\n");
851+
"inner step divides the vector alignment.\n");
838852
else
839853
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
840-
"inner step doesn't divide the vector-size.\n");
854+
"inner step doesn't divide the vector"
855+
" alignment.\n");
841856
}
842857
}
843858

844859
/* Similarly we can only use base and misalignment information relative to
845860
an innermost loop if the misalignment stays the same throughout the
846861
execution of the loop. As above, this is the case if the stride of
847-
the dataref evenly divides by the vector size. */
862+
the dataref evenly divides by the alignment. */
848863
else
849864
{
850865
unsigned vf = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
851866
step_preserves_misalignment_p
852-
= ((DR_STEP_ALIGNMENT (dr) * vf)
853-
% GET_MODE_SIZE (TYPE_MODE (vectype))) == 0;
867+
= ((DR_STEP_ALIGNMENT (dr) * vf) % vector_alignment) == 0;
854868

855869
if (!step_preserves_misalignment_p && dump_enabled_p ())
856870
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
857-
"step doesn't divide the vector-size.\n");
871+
"step doesn't divide the vector alignment.\n");
858872
}
859873

860874
unsigned int base_alignment = drb->base_alignment;
861875
unsigned int base_misalignment = drb->base_misalignment;
862-
unsigned HOST_WIDE_INT vector_alignment = TYPE_ALIGN_UNIT (vectype);
863876

864877
/* Calculate the maximum of the pooled base address alignment and the
865878
alignment that we can compute for DR itself. */
@@ -1007,9 +1020,8 @@ vect_update_misalignment_for_peel (struct data_reference *dr,
10071020
{
10081021
bool negative = tree_int_cst_compare (DR_STEP (dr), size_zero_node) < 0;
10091022
int misal = DR_MISALIGNMENT (dr);
1010-
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
10111023
misal += negative ? -npeel * dr_size : npeel * dr_size;
1012-
misal &= (TYPE_ALIGN (vectype) / BITS_PER_UNIT) - 1;
1024+
misal &= DR_TARGET_ALIGNMENT (dr) - 1;
10131025
SET_DR_MISALIGNMENT (dr, misal);
10141026
return;
10151027
}
@@ -1657,16 +1669,17 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
16571669
{
16581670
if (known_alignment_for_access_p (dr))
16591671
{
1660-
unsigned int npeel_tmp = 0;
1672+
unsigned int npeel_tmp = 0;
16611673
bool negative = tree_int_cst_compare (DR_STEP (dr),
16621674
size_zero_node) < 0;
16631675

1664-
vectype = STMT_VINFO_VECTYPE (stmt_info);
1665-
nelements = TYPE_VECTOR_SUBPARTS (vectype);
1666-
mis = DR_MISALIGNMENT (dr) / vect_get_scalar_dr_size (dr);
1676+
vectype = STMT_VINFO_VECTYPE (stmt_info);
1677+
nelements = TYPE_VECTOR_SUBPARTS (vectype);
1678+
unsigned int target_align = DR_TARGET_ALIGNMENT (dr);
1679+
unsigned int dr_size = vect_get_scalar_dr_size (dr);
1680+
mis = (negative ? DR_MISALIGNMENT (dr) : -DR_MISALIGNMENT (dr));
16671681
if (DR_MISALIGNMENT (dr) != 0)
1668-
npeel_tmp = (negative ? (mis - nelements)
1669-
: (nelements - mis)) & (nelements - 1);
1682+
npeel_tmp = (mis & (target_align - 1)) / dr_size;
16701683

16711684
/* For multiple types, it is possible that the bigger type access
16721685
will have more than one peeling option. E.g., a loop with two
@@ -1701,7 +1714,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
17011714
{
17021715
vect_peeling_hash_insert (&peeling_htab, loop_vinfo,
17031716
dr, npeel_tmp);
1704-
npeel_tmp += nelements;
1717+
npeel_tmp += target_align / dr_size;
17051718
}
17061719

17071720
one_misalignment_known = true;
@@ -1922,7 +1935,6 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
19221935
stmt = DR_STMT (dr0);
19231936
stmt_info = vinfo_for_stmt (stmt);
19241937
vectype = STMT_VINFO_VECTYPE (stmt_info);
1925-
nelements = TYPE_VECTOR_SUBPARTS (vectype);
19261938

19271939
if (known_alignment_for_access_p (dr0))
19281940
{
@@ -1935,9 +1947,10 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
19351947
updating DR_MISALIGNMENT values. The peeling factor is the
19361948
vectorization factor minus the misalignment as an element
19371949
count. */
1938-
mis = DR_MISALIGNMENT (dr0) / vect_get_scalar_dr_size (dr0);
1939-
npeel = ((negative ? mis - nelements : nelements - mis)
1940-
& (nelements - 1));
1950+
mis = negative ? DR_MISALIGNMENT (dr0) : -DR_MISALIGNMENT (dr0);
1951+
unsigned int target_align = DR_TARGET_ALIGNMENT (dr0);
1952+
npeel = ((mis & (target_align - 1))
1953+
/ vect_get_scalar_dr_size (dr0));
19411954
}
19421955

19431956
/* For interleaved data access every iteration accesses all the
@@ -1976,10 +1989,8 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
19761989
unsigned max_peel = npeel;
19771990
if (max_peel == 0)
19781991
{
1979-
gimple *dr_stmt = DR_STMT (dr0);
1980-
stmt_vec_info vinfo = vinfo_for_stmt (dr_stmt);
1981-
tree vtype = STMT_VINFO_VECTYPE (vinfo);
1982-
max_peel = TYPE_VECTOR_SUBPARTS (vtype) - 1;
1992+
unsigned int target_align = DR_TARGET_ALIGNMENT (dr0);
1993+
max_peel = target_align / vect_get_scalar_dr_size (dr0) - 1;
19831994
}
19841995
if (max_peel > max_allowed_peel)
19851996
{
@@ -2201,8 +2212,10 @@ vect_find_same_alignment_drs (struct data_dependence_relation *ddr)
22012212
if (diff != 0)
22022213
{
22032214
/* Get the wider of the two alignments. */
2204-
unsigned int align_a = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmtinfo_a));
2205-
unsigned int align_b = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmtinfo_b));
2215+
unsigned int align_a = (vect_calculate_target_alignment (dra)
2216+
/ BITS_PER_UNIT);
2217+
unsigned int align_b = (vect_calculate_target_alignment (drb)
2218+
/ BITS_PER_UNIT);
22062219
unsigned int max_align = MAX (align_a, align_b);
22072220

22082221
/* Require the gap to be a multiple of the larger vector alignment. */
@@ -3995,16 +4008,15 @@ vect_get_new_ssa_name (tree type, enum vect_var_kind var_kind, const char *name)
39954008
/* Duplicate ptr info and set alignment/misaligment on NAME from DR. */
39964009

39974010
static void
3998-
vect_duplicate_ssa_name_ptr_info (tree name, data_reference *dr,
3999-
stmt_vec_info stmt_info)
4011+
vect_duplicate_ssa_name_ptr_info (tree name, data_reference *dr)
40004012
{
40014013
duplicate_ssa_name_ptr_info (name, DR_PTR_INFO (dr));
4002-
unsigned int align = TYPE_ALIGN_UNIT (STMT_VINFO_VECTYPE (stmt_info));
40034014
int misalign = DR_MISALIGNMENT (dr);
40044015
if (misalign == DR_MISALIGNMENT_UNKNOWN)
40054016
mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (name));
40064017
else
4007-
set_ptr_info_alignment (SSA_NAME_PTR_INFO (name), align, misalign);
4018+
set_ptr_info_alignment (SSA_NAME_PTR_INFO (name),
4019+
DR_TARGET_ALIGNMENT (dr), misalign);
40084020
}
40094021

40104022
/* Function vect_create_addr_base_for_vector_ref.
@@ -4109,7 +4121,7 @@ vect_create_addr_base_for_vector_ref (gimple *stmt,
41094121
&& TREE_CODE (addr_base) == SSA_NAME
41104122
&& !SSA_NAME_PTR_INFO (addr_base))
41114123
{
4112-
vect_duplicate_ssa_name_ptr_info (addr_base, dr, stmt_info);
4124+
vect_duplicate_ssa_name_ptr_info (addr_base, dr);
41134125
if (offset || byte_offset)
41144126
mark_ptr_info_alignment_unknown (SSA_NAME_PTR_INFO (addr_base));
41154127
}
@@ -4368,8 +4380,8 @@ vect_create_data_ref_ptr (gimple *stmt, tree aggr_type, struct loop *at_loop,
43684380
/* Copy the points-to information if it exists. */
43694381
if (DR_PTR_INFO (dr))
43704382
{
4371-
vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr, stmt_info);
4372-
vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr, stmt_info);
4383+
vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr);
4384+
vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr);
43734385
}
43744386
if (ptr_incr)
43754387
*ptr_incr = incr;
@@ -4398,8 +4410,8 @@ vect_create_data_ref_ptr (gimple *stmt, tree aggr_type, struct loop *at_loop,
43984410
/* Copy the points-to information if it exists. */
43994411
if (DR_PTR_INFO (dr))
44004412
{
4401-
vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr, stmt_info);
4402-
vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr, stmt_info);
4413+
vect_duplicate_ssa_name_ptr_info (indx_before_incr, dr);
4414+
vect_duplicate_ssa_name_ptr_info (indx_after_incr, dr);
44034415
}
44044416
if (ptr_incr)
44054417
*ptr_incr = incr;
@@ -5003,10 +5015,10 @@ vect_setup_realignment (gimple *stmt, gimple_stmt_iterator *gsi,
50035015
new_temp = copy_ssa_name (ptr);
50045016
else
50055017
new_temp = make_ssa_name (TREE_TYPE (ptr));
5018+
unsigned int align = DR_TARGET_ALIGNMENT (dr);
50065019
new_stmt = gimple_build_assign
50075020
(new_temp, BIT_AND_EXPR, ptr,
5008-
build_int_cst (TREE_TYPE (ptr),
5009-
-(HOST_WIDE_INT)TYPE_ALIGN_UNIT (vectype)));
5021+
build_int_cst (TREE_TYPE (ptr), -(HOST_WIDE_INT) align));
50105022
new_bb = gsi_insert_on_edge_immediate (pe, new_stmt);
50115023
gcc_assert (!new_bb);
50125024
data_ref

0 commit comments

Comments
 (0)