Hi,

This patch makes the vectorizer treat any vector widening IFN as simple, like
it did with the tree codes VEC_WIDEN_*.

I wasn't sure whether I should make all IFN's simple and then exclude some (like GOMP_ ones), or include more than just the new widening IFNs. But since this is the only behaviour that changed with the ifn patch, I decided to only special case the widening IFNs for now. Let me know if you have different thoughts on this.

Bootstrapped and regression tested on aarch64-unknow-linux-gnu.

gcc/ChangeLog:

        PR tree-optimization/110436
        * tree-vect-stmts.cc (is_simple_and_all_uses_invariant): Treat widening
        IFN's as simple.

gcc/testsuite/ChangeLog:

        * gcc.dg/pr110436.c: New test.
diff --git a/gcc/testsuite/gcc.dg/pr110436.c b/gcc/testsuite/gcc.dg/pr110436.c
new file mode 100644
index 
0000000000000000000000000000000000000000..c146f99fac9f0524eaa3b1230b56e9f94eed5bda
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/pr110436.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-O3" } */
+
+#include "pr83089.c"
+
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 
d642d3c257f8d540a8562eedbcd40372b9550959..706055e9af94f0c1500c25faf4bd74fc08bf3cd6
 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -296,8 +296,11 @@ is_simple_and_all_uses_invariant (stmt_vec_info stmt_info,
   tree op;
   ssa_op_iter iter;
 
-  gassign *stmt = dyn_cast <gassign *> (stmt_info->stmt);
-  if (!stmt)
+  gimple *stmt = stmt_info->stmt;
+  if (!is_gimple_assign (stmt)
+      && !(is_gimple_call (stmt)
+          && gimple_call_internal_p (stmt)
+          && widening_fn_p (gimple_call_combined_fn (stmt))))
     return false;
 
   FOR_EACH_SSA_TREE_OPERAND (op, stmt, iter, SSA_OP_USE)

Reply via email to