--- /dev/null
+/* { dg-require-effective-target vect_int } */
+
+#include "tree-vect.h"
+
+int pix[4];
+
+int __attribute__((noipa)) foo (void)
+{
+ pix[0] = pix[0] / 4;
+ pix[1] = pix[1] / 4;
+ pix[2] = pix[2] / 4;
+ pix[3] = pix[3] / 4;
+ return pix[0] + pix[1] + pix[2] + pix[3];
+}
+
+int main ()
+{
+ check_vect ();
+
+ pix[0] = 8;
+ pix[1] = 16;
+ pix[2] = 32;
+ pix[3] = 64;
+ if (foo () != 30)
+ __builtin_abort ();
+ return 0;
+}
bool all_visited = true;
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
{
- stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
- if (svisited.contains (orig_stmt_info))
+ if (svisited.contains (stmt_info))
continue;
all_visited = false;
+ stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
+ if (STMT_VINFO_IN_PATTERN_P (orig_stmt_info)
+ && STMT_VINFO_RELATED_STMT (orig_stmt_info) != stmt_info)
+ /* Only the pattern root stmt computes the original scalar value. */
+ continue;
bool mark_visited = true;
gimple *orig_stmt = orig_stmt_info->stmt;
ssa_op_iter op_iter;
}
}
if (mark_visited)
- svisited.add (orig_stmt_info);
+ svisited.add (stmt_info);
}
if (all_visited)
return;