Fix SIMD call SLP discovery

Message ID 20231005113731.454013856DD0@sourceware.org
State Unresolved
Headers
Series Fix SIMD call SLP discovery |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Richard Biener Oct. 5, 2023, 11:37 a.m. UTC
  When we do SLP discovery of SIMD calls we run into the issue that
when the call is neither builtin nor internal function we have
cfn == CFN_LAST but internal_fn_p of that returns true.  Since
IFN_LAST isn't vectorizable we fail spuriously.

Fixed by checking for cfn != CFN_LAST && internal_fn_p (cfn)
instead.

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

	* tree-vect-slp.cc (vect_build_slp_tree_1): Do not
	ask for internal_fn_p (CFN_LAST).
---
 gcc/tree-vect-slp.cc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index 4dd899404d9..08e8418b33e 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -1084,7 +1084,8 @@  vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
 	      ldst_p = true;
 	      rhs_code = CFN_MASK_STORE;
 	    }
-	  else if ((internal_fn_p (cfn)
+	  else if ((cfn != CFN_LAST
+		    && internal_fn_p (cfn)
 		    && !vectorizable_internal_fn_p (as_internal_fn (cfn)))
 		   || gimple_call_tail_p (call_stmt)
 		   || gimple_call_noreturn_p (call_stmt)