[gcc r16-7037] tree-optimization/123794 - fix OMP SIMD scalar call removal
Richard Biener
rguenth@gcc.gnu.org
Mon Jan 26 08:19:54 GMT 2026
https://gcc.gnu.org/g:3e0430bca4b546c07067df00644d251e55fecbad
commit r16-7037-g3e0430bca4b546c07067df00644d251e55fecbad
Author: Richard Biener <rguenther@suse.de>
Date: Mon Jan 26 08:05:34 2026 +0100
tree-optimization/123794 - fix OMP SIMD scalar call removal
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.
Diff:
---
gcc/testsuite/gcc.dg/vect/vect-simd-clone-pr123794.c | 13 +++++++++++++
gcc/tree-vect-slp.cc | 6 ++----
2 files changed, 15 insertions(+), 4 deletions(-)
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
index 000000000000..2674b1e2961d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/vect/vect-simd-clone-pr123794.c
@@ -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);
+}
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index e4e0320c6781..c481efc749f7 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -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)
More information about the Gcc-cvs
mailing list