]> git.ipfire.org Git - thirdparty/gcc.git/commit
match.pd: Fix fneg/fadd optimization [PR109583]
authorJakub Jelinek <jakub@redhat.com>
Sat, 22 Apr 2023 08:24:29 +0000 (10:24 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sat, 22 Apr 2023 08:32:17 +0000 (10:32 +0200)
commit9b6bf076c11cba0f9ccdace63e8b4044b1a858ea
tree336187123592f8be162eb754eb0d4621bc622989
parent19c8d725e68c22c6dad156e40244f263ac19d55f
match.pd: Fix fneg/fadd optimization [PR109583]

The following testcase ICEs on x86, foo function since my r14-22
improvement, but bar already since r13-4122.  The problem is the same,
in the if expression related_vector_mode is called and that starts with
  gcc_assert (VECTOR_MODE_P (vector_mode));
but nothing in the fneg/fadd match.pd pattern actually checks if the
VEC_PERM type has VECTOR_MODE_P (vec_mode).  In this case it has BLKmode
and so it ICEs.

The following patch makes sure we don't ICE on it.

2023-04-22  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109583
* match.pd (fneg/fadd simplify): Don't call related_vector_mode
if vec_mode is not VECTOR_MODE_P.

* gcc.dg/pr109583.c: New test.

(cherry picked from commit c58c0771b7a3dbd2a00cd4b6ca2301d74b6cd4e2)
gcc/match.pd
gcc/testsuite/gcc.dg/pr109583.c [new file with mode: 0644]