]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/123794 - fix OMP SIMD scalar call removal
authorRichard Biener <rguenther@suse.de>
Mon, 26 Jan 2026 07:05:34 +0000 (08:05 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 26 Jan 2026 08:19:43 +0000 (09:19 +0100)
The following makes sure to purge VDEFs for all calls.

PR tree-optimization/123794
* tree-vect-slp.cc (vect_remove_slp_scalar_calls): Unlink
VOPs for all calls.

* gcc.dg/vect/vect-simd-clone-pr123794.c: New testcase.

gcc/testsuite/gcc.dg/vect/vect-simd-clone-pr123794.c [new file with mode: 0644]
gcc/tree-vect-slp.cc

diff --git a/gcc/testsuite/gcc.dg/vect/vect-simd-clone-pr123794.c b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-pr123794.c
new file mode 100644 (file)
index 0000000..2674b1e
--- /dev/null
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-require-effective-target vect_simd_clones } */
+/* { dg-additional-options "-fopenmp-simd" } */
+
+extern long a[];
+#pragma omp declare simd
+long my_fun(long);
+long foo_i;
+void foo() {
+#pragma omp simd
+  for (foo_i = 0; foo_i < 3; foo_i += 1)
+    a[foo_i] = my_fun(foo_i);
+}
index e4e0320c6781f9dee2cb80569c887b695d568903..c481efc749f7ed1499b25e6576f16180494ccdba 100644 (file)
@@ -12135,10 +12135,8 @@ vect_remove_slp_scalar_calls (vec_info *vinfo,
       if (lhs)
        new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs)));
       else
-       {
-         new_stmt = gimple_build_nop ();
-         unlink_stmt_vdef (stmt_info->stmt);
-       }
+       new_stmt = gimple_build_nop ();
+      unlink_stmt_vdef (stmt_info->stmt);
       gsi = gsi_for_stmt (stmt);
       vinfo->replace_stmt (&gsi, stmt_info, new_stmt);
       if (lhs)