This moves per-stmt checks before the comparison so the result
does not depend on whether a stmt is first.
Bootstrapped and tested on x86_64-unknown-linux-gnu.
* tree-vect-slp.cc (vect_build_slp_tree_12): Move stmt-local
checks first.
---
gcc/tree-vect-slp.cc | 41 +++++++++++++++++++++--------------------
1 file changed, 21 insertions(+), 20 deletions(-)
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index eb42b384962..3b4468cd6e3 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1272,6 +1272,27 @@ vect_build_slp_tree_12 (vec_info *vinfo, unsigned char
*swap,
ldst_p = STMT_VINFO_DATA_REF (stmt_info) != nullptr;
}
+ if (!ldst_p
+ && !phi_p
+ && rhs_code.is_tree_code ()
+ && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_binary
+ && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_unary
+ && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_expression
+ && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_comparison
+ && rhs_code != VIEW_CONVERT_EXPR
+ && rhs_code != CALL_EXPR
+ && rhs_code != BIT_FIELD_REF
+ && rhs_code != SSA_NAME)
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "Build SLP failed: operation unsupported %G",
+ stmt);
+ if (is_a <bb_vec_info> (vinfo) && i != 0)
+ continue;
+ return false;
+ }
+
/* Check the operation. */
if (i == 0)
{
@@ -1559,26 +1580,6 @@ vect_build_slp_tree_12 (vec_info *vinfo, unsigned char
*swap,
/* Not memory operation. */
else
{
- if (!phi_p
- && rhs_code.is_tree_code ()
- && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_binary
- && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_unary
- && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_expression
- && TREE_CODE_CLASS (tree_code (rhs_code)) != tcc_comparison
- && rhs_code != VIEW_CONVERT_EXPR
- && rhs_code != CALL_EXPR
- && rhs_code != BIT_FIELD_REF
- && rhs_code != SSA_NAME)
- {
- if (dump_enabled_p ())
- dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
- "Build SLP failed: operation unsupported %G",
- stmt);
- if (is_a <bb_vec_info> (vinfo) && i != 0)
- continue;
- return false;
- }
-
if (rhs_code == COND_EXPR)
{
tree cond_expr = gimple_assign_rhs1 (stmt);
--
2.51.0