Skip to content

Commit 2c27600

Browse files
committed
Simplify intereaved store vectorization processing
When doing interleaving we perform code generation when visiting the last store of a chain. We keep track of this via DR_GROUP_STORE_COUNT, the following localizes this to the caller of vectorizable_store, also avoing redundant non-processing of the other stores. * tree-vect-stmts.cc (vectorizable_store): Do not bump DR_GROUP_STORE_COUNT here. Remove early out. (vect_transform_stmt): Only call vectorizable_store on the last element of an interleaving chain.
1 parent 9e5b47b commit 2c27600

File tree

1 file changed

+14
-26
lines changed

1 file changed

+14
-26
lines changed

gcc/tree-vect-stmts.cc

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8429,24 +8429,11 @@ vectorizable_store (vec_info *vinfo,
84298429
else if (STMT_VINFO_SIMD_LANE_ACCESS_P (stmt_info) >= 3)
84308430
return vectorizable_scan_store (vinfo, stmt_info, gsi, vec_stmt, ncopies);
84318431

8432-
if (STMT_VINFO_GROUPED_ACCESS (stmt_info))
8433-
DR_GROUP_STORE_COUNT (DR_GROUP_FIRST_ELEMENT (stmt_info))++;
8434-
84358432
if (grouped_store)
84368433
{
84378434
/* FORNOW */
84388435
gcc_assert (!loop || !nested_in_vect_loop_p (loop, stmt_info));
84398436

8440-
/* We vectorize all the stmts of the interleaving group when we
8441-
reach the last stmt in the group. */
8442-
if (DR_GROUP_STORE_COUNT (first_stmt_info)
8443-
< DR_GROUP_SIZE (first_stmt_info)
8444-
&& !slp)
8445-
{
8446-
*vec_stmt = NULL;
8447-
return true;
8448-
}
8449-
84508437
if (slp)
84518438
{
84528439
grouped_store = false;
@@ -12487,21 +12474,22 @@ vect_transform_stmt (vec_info *vinfo,
1248712474
break;
1248812475

1248912476
case store_vec_info_type:
12490-
done = vectorizable_store (vinfo, stmt_info,
12491-
gsi, &vec_stmt, slp_node, NULL);
12492-
gcc_assert (done);
12493-
if (STMT_VINFO_GROUPED_ACCESS (stmt_info) && !slp_node)
12477+
if (STMT_VINFO_GROUPED_ACCESS (stmt_info)
12478+
&& !slp_node
12479+
&& (++DR_GROUP_STORE_COUNT (DR_GROUP_FIRST_ELEMENT (stmt_info))
12480+
< DR_GROUP_SIZE (DR_GROUP_FIRST_ELEMENT (stmt_info))))
12481+
/* In case of interleaving, the whole chain is vectorized when the
12482+
last store in the chain is reached. Store stmts before the last
12483+
one are skipped, and there vec_stmt_info shouldn't be freed
12484+
meanwhile. */
12485+
;
12486+
else
1249412487
{
12495-
/* In case of interleaving, the whole chain is vectorized when the
12496-
last store in the chain is reached. Store stmts before the last
12497-
one are skipped, and there vec_stmt_info shouldn't be freed
12498-
meanwhile. */
12499-
stmt_vec_info group_info = DR_GROUP_FIRST_ELEMENT (stmt_info);
12500-
if (DR_GROUP_STORE_COUNT (group_info) == DR_GROUP_SIZE (group_info))
12501-
is_store = true;
12488+
done = vectorizable_store (vinfo, stmt_info,
12489+
gsi, &vec_stmt, slp_node, NULL);
12490+
gcc_assert (done);
12491+
is_store = true;
1250212492
}
12503-
else
12504-
is_store = true;
1250512493
break;
1250612494

1250712495
case condition_vec_info_type:

0 commit comments

Comments
 (0)