]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-optimization/123756 - remove now bogus assert in reduction vect
authorRichard Biener <rguenther@suse.de>
Thu, 22 Jan 2026 10:11:18 +0000 (11:11 +0100)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 22 Jan 2026 12:01:37 +0000 (13:01 +0100)
With r16-5372-gfacb92812a4ec5 I have generalized reduction operator
support to allow (masked) internal functions in more cases.  The
following removes an now bogus assert given IFN_FMAX is now allowed
given IFN_COND_FMAX is available.

PR tree-optimization/123756
* tree-vect-loop.cc (vect_transform_reduction): Remove
bogus assert.

* gcc.dg/vect/vect-pr123756.c: New testcase.

gcc/testsuite/gcc.dg/vect/vect-pr123756.c [new file with mode: 0644]
gcc/tree-vect-loop.cc

diff --git a/gcc/testsuite/gcc.dg/vect/vect-pr123756.c b/gcc/testsuite/gcc.dg/vect/vect-pr123756.c
new file mode 100644 (file)
index 0000000..46ca157
--- /dev/null
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+
+double
+foo (double m, float *ptr)
+{
+  for (int i = 0; i < 256; i++)
+    m = __builtin_fmax (m, ptr[i]);
+  return m;
+}
index c8b9c6268c8464b4bee1db1b953d997bf934585c..d3f9ffad52ecc8af9c475aa1103453508f41bc39 100644 (file)
@@ -8233,11 +8233,8 @@ vect_transform_reduction (loop_vec_info loop_vinfo,
                                                 vop[2], vop[reduc_index]);
            }
          else
-           {
-             gcc_assert (code.is_tree_code ());
-             call = gimple_build_call_internal (cond_fn, 4, mask, vop[0],
-                                                vop[1], vop[reduc_index]);
-           }
+           call = gimple_build_call_internal (cond_fn, 4, mask, vop[0],
+                                              vop[1], vop[reduc_index]);
          new_temp = make_ssa_name (vec_dest, call);
          gimple_call_set_lhs (call, new_temp);
          gimple_call_set_nothrow (call, true);