VECT: Support SLP for MASK_LEN_GATHER_LOAD with dummy mask

This patch fixes following FAILs for RVV:
FAIL: gcc.dg/vect/vect-gather-1.c -flto -ffat-lto-objects  scan-tree-dump vect "Loop contains only SLP stmts"
FAIL: gcc.dg/vect/vect-gather-1.c scan-tree-dump vect "Loop contains only SLP stmts"

Bootstrap on X86 and regtest passed.

Ok for trunk ?

        PR tree-optimization/111721

gcc/ChangeLog:

	* tree-vect-slp.cc (vect_get_and_check_slp_defs): Support SLP for dummy mask -1.
	* tree-vect-stmts.cc (vectorizable_load): Ditto.
This commit is contained in:
Juzhe-Zhong 2023-11-03 14:41:13 +08:00 committed by Pan Li
parent c0cf9b7857
commit 60034ecf25
2 changed files with 5 additions and 5 deletions

View file

@ -759,9 +759,8 @@ vect_get_and_check_slp_defs (vec_info *vinfo, unsigned char swap,
if ((dt == vect_constant_def
|| dt == vect_external_def)
&& !GET_MODE_SIZE (vinfo->vector_mode).is_constant ()
&& (TREE_CODE (type) == BOOLEAN_TYPE
|| !can_duplicate_and_interleave_p (vinfo, stmts.length (),
type)))
&& TREE_CODE (type) != BOOLEAN_TYPE
&& !can_duplicate_and_interleave_p (vinfo, stmts.length (), type))
{
if (dump_enabled_p ())
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,

View file

@ -9805,6 +9805,7 @@ vectorizable_load (vec_info *vinfo,
tree mask = NULL_TREE, mask_vectype = NULL_TREE;
int mask_index = -1;
slp_tree slp_op = NULL;
if (gassign *assign = dyn_cast <gassign *> (stmt_info->stmt))
{
scalar_dest = gimple_assign_lhs (assign);
@ -9841,7 +9842,7 @@ vectorizable_load (vec_info *vinfo,
mask_index = vect_slp_child_index_for_operand (call, mask_index);
if (mask_index >= 0
&& !vect_check_scalar_mask (vinfo, stmt_info, slp_node, mask_index,
&mask, NULL, &mask_dt, &mask_vectype))
&mask, &slp_op, &mask_dt, &mask_vectype))
return false;
}
@ -10026,7 +10027,7 @@ vectorizable_load (vec_info *vinfo,
{
if (slp_node
&& mask
&& !vect_maybe_update_slp_op_vectype (SLP_TREE_CHILDREN (slp_node)[0],
&& !vect_maybe_update_slp_op_vectype (slp_op,
mask_vectype))
{
if (dump_enabled_p ())