It was reported that some AVX10 test like
gcc.target/i386/avx10_2-vcvtbf162ibs-2.c ICEd with my
changes.  It turns out it's due to associated_internal_fn
only supporting BUILT_IN_NORMAL calls.

This adds a check for this before calling
associated_internal_fn.

Manually tested the files since they have an effective
target tests for hardware I don't have.

Bootstrapped Regtested on aarch64-none-linux-gnu,
arm-none-linux-gnueabihf, x86_64-pc-linux-gnu
-m32, -m64 and no issues.

Pushed.

Thanks,
Tamar

gcc/ChangeLog:

        PR tree-optimization/122103
        * tree-if-conv.cc (ifcvt_can_predicate): Add check for
        normal builtins.

---
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 
53227bd64c16deca60f81896a259c8e1b155e56c..6f258a390761b52e1a79ae991327d3ceae33e1e8
 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -1006,8 +1006,10 @@ ifcvt_can_predicate (gimple *stmt)
   if (gimple_assign_single_p (stmt))
     return ifcvt_can_use_mask_load_store (stmt);
 
+  tree callee;
   if (gimple_call_builtin_p (stmt))
-    if (tree callee = gimple_call_fndecl (stmt))
+    if ((callee = gimple_call_fndecl (stmt))
+       && fndecl_built_in_p (callee, BUILT_IN_NORMAL))
       {
        auto ifn = associated_internal_fn (callee);
        auto cond_ifn = get_conditional_internal_fn (ifn);


-- 
diff --git a/gcc/tree-if-conv.cc b/gcc/tree-if-conv.cc
index 53227bd64c16deca60f81896a259c8e1b155e56c..6f258a390761b52e1a79ae991327d3ceae33e1e8 100644
--- a/gcc/tree-if-conv.cc
+++ b/gcc/tree-if-conv.cc
@@ -1006,8 +1006,10 @@ ifcvt_can_predicate (gimple *stmt)
   if (gimple_assign_single_p (stmt))
     return ifcvt_can_use_mask_load_store (stmt);
 
+  tree callee;
   if (gimple_call_builtin_p (stmt))
-    if (tree callee = gimple_call_fndecl (stmt))
+    if ((callee = gimple_call_fndecl (stmt))
+	&& fndecl_built_in_p (callee, BUILT_IN_NORMAL))
       {
 	auto ifn = associated_internal_fn (callee);
 	auto cond_ifn = get_conditional_internal_fn (ifn);

Reply via email to