diff options
author | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2022-10-28 15:05:11 +0100 |
---|---|---|
committer | Andre Vieira <andre.simoesdiasvieira@arm.com> | 2022-10-28 15:05:11 +0100 |
commit | 95decac3ce8c8c7c5302cd6fac005a10463de165 (patch) | |
tree | 797fec6601837fcb59311e112d626ae2d57458e8 /gcc | |
parent | 031a400e49d8db156c43f9ec0b21ab0c2aee8c6d (diff) | |
download | gcc-95decac3ce8c8c7c5302cd6fac005a10463de165.zip gcc-95decac3ce8c8c7c5302cd6fac005a10463de165.tar.gz gcc-95decac3ce8c8c7c5302cd6fac005a10463de165.tar.bz2 |
vect: Reject non-byte offsets for gather/scatters [PR107346]
The ada failure reported in the PR was being caused by vect_check_gather_scatter
failing to deal with bit offsets that weren't multiples of BITS_PER_UNIT. This
patch makes vect_check_gather_scatter reject memory accesses with such offsets.
gcc/ChangeLog:
PR tree-optimization/107346
* tree-vect-data-refs.cc (vect_check_gather_scatter): Reject offsets
that aren't multiples of BITS_PER_UNIT.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/tree-vect-data-refs.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/tree-vect-data-refs.cc b/gcc/tree-vect-data-refs.cc index 4a23d61..6c89279 100644 --- a/gcc/tree-vect-data-refs.cc +++ b/gcc/tree-vect-data-refs.cc @@ -4016,6 +4016,11 @@ vect_check_gather_scatter (stmt_vec_info stmt_info, loop_vec_info loop_vinfo, if (reversep) return false; + /* PR 107346. Packed structs can have fields at offsets that are not + multiples of BITS_PER_UNIT. Do not use gather/scatters in such cases. */ + if (!multiple_p (pbitpos, BITS_PER_UNIT)) + return false; + poly_int64 pbytepos = exact_div (pbitpos, BITS_PER_UNIT); if (TREE_CODE (base) == MEM_REF) |