Skip to content

Commit f5bd88b

Browse files
rguenthRichard Biener
authored andcommitted
tree-optimization/117709 - bogus offset for gather load
When diverting to VMAT_GATHER_SCATTER we fail to zero *poffset which was previously set if a load was classified as VMAT_CONTIGUOUS_REVERSE. The following refactors get_group_load_store_type a bit to avoid this but this all needs some serious TLC. PR tree-optimization/117709 * tree-vect-stmts.cc (get_group_load_store_type): Only set *poffset when we end up with VMAT_CONTIGUOUS_DOWN or VMAT_CONTIGUOUS_REVERSE.
1 parent 2383ed1 commit f5bd88b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

gcc/tree-vect-stmts.cc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,7 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
20482048
unsigned int group_size;
20492049
unsigned HOST_WIDE_INT gap;
20502050
bool single_element_p;
2051+
poly_int64 neg_ldst_offset = 0;
20512052
if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
20522053
{
20532054
first_stmt_info = DR_GROUP_FIRST_ELEMENT (stmt_info);
@@ -2105,7 +2106,8 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
21052106
/* ??? The VMAT_CONTIGUOUS_REVERSE code generation is
21062107
only correct for single element "interleaving" SLP. */
21072108
*memory_access_type = get_negative_load_store_type
2108-
(vinfo, stmt_info, vectype, vls_type, 1, poffset);
2109+
(vinfo, stmt_info, vectype, vls_type, 1,
2110+
&neg_ldst_offset);
21092111
else
21102112
{
21112113
/* Try to use consecutive accesses of DR_GROUP_SIZE elements,
@@ -2375,6 +2377,10 @@ get_group_load_store_type (vec_info *vinfo, stmt_vec_info stmt_info,
23752377
masked_p, gs_info, elsvals))
23762378
*memory_access_type = VMAT_GATHER_SCATTER;
23772379

2380+
if (*memory_access_type == VMAT_CONTIGUOUS_DOWN
2381+
|| *memory_access_type == VMAT_CONTIGUOUS_REVERSE)
2382+
*poffset = neg_ldst_offset;
2383+
23782384
if (*memory_access_type == VMAT_GATHER_SCATTER
23792385
|| *memory_access_type == VMAT_ELEMENTWISE
23802386
|| *memory_access_type == VMAT_STRIDED_SLP

0 commit comments

Comments
 (0)