This is another tiny piece in some bigger refactoring of
vect_get_and_check_slp_defs.  Split out a test that has nothing
to do with def types or commutation.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

2020-10-14  Richard Biener  <rguent...@suse.de>

        * tree-vect-slp.c (vect_get_and_check_slp_defs): Split out
        test for compatible operand types.
---
 gcc/tree-vect-slp.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index ba681fe6d5e..5e0a3608948 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -486,6 +486,14 @@ again:
        }
       else
        {
+         if (!types_compatible_p (oprnd_info->first_op_type, type))
+           {
+             if (dump_enabled_p ())
+               dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+                                "Build SLP failed: different operand types\n");
+             return 1;
+           }
+
          /* Not first stmt of the group, check that the def-stmt/s match
             the def-stmt/s of the first stmt.  Allow different definition
             types for reduction chains: the first stmt must be a
@@ -503,7 +511,6 @@ again:
                     || oprnd_info->first_dt == vect_constant_def)
                    && (dt == vect_external_def
                        || dt == vect_constant_def)))
-             || !types_compatible_p (oprnd_info->first_op_type, type)
              || (!STMT_VINFO_DATA_REF (stmt_info)
                  && REDUC_GROUP_FIRST_ELEMENT (stmt_info)
                  && ((!def_stmt_info
-- 
2.26.2

Reply via email to