diff options
author | Richard Biener <rguenther@suse.de> | 2020-07-06 16:26:50 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2020-07-06 16:30:18 +0200 |
commit | dccbf1e2a6e544f71b4a5795f0c79015db019fc3 (patch) | |
tree | 2cfd3cde5c4d1f6dc40a8db09e7925919ca18185 /gcc/tree-vect-data-refs.c | |
parent | a9e48b0d475407bbc79be88c6d086a9d837d4ca3 (diff) | |
download | gcc-dccbf1e2a6e544f71b4a5795f0c79015db019fc3.zip gcc-dccbf1e2a6e544f71b4a5795f0c79015db019fc3.tar.gz gcc-dccbf1e2a6e544f71b4a5795f0c79015db019fc3.tar.bz2 |
tree-optimization/96075 - fix bogus misalignment calculation
This fixes bogus misalignment calculation for negative steps
since an assertion a previous comment indicated no longer holds:
/* DR_STEP(dr) is the same as -TYPE_SIZE of the scalar type,
otherwise we wouldn't be here. */
Thus the following replaces DR_STEP by -TYPE_SIZE.
2020-07-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/96075
* tree-vect-data-refs.c (vect_compute_data_ref_alignment): Use
TYPE_SIZE_UNIT of the vector component type instead of DR_STEP
for the misalignment calculation for negative step.
* gcc.dg/vect/slp-46.c: New testcase.
Diffstat (limited to 'gcc/tree-vect-data-refs.c')
-rw-r--r-- | gcc/tree-vect-data-refs.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c index 2462276..959c2d3 100644 --- a/gcc/tree-vect-data-refs.c +++ b/gcc/tree-vect-data-refs.c @@ -1109,7 +1109,7 @@ vect_compute_data_ref_alignment (vec_info *vinfo, dr_vec_info *dr_info) if (tree_int_cst_sgn (drb->step) < 0) /* PLUS because STEP is negative. */ misalignment += ((TYPE_VECTOR_SUBPARTS (vectype) - 1) - * TREE_INT_CST_LOW (drb->step)); + * -TREE_INT_CST_LOW (TYPE_SIZE_UNIT (TREE_TYPE (vectype)))); unsigned int const_misalignment; if (!known_misalignment (misalignment, vect_align_c, &const_misalignment)) |