]> gcc.gnu.org Git - gcc.git/commit
veclower: Fix up -fcompare-debug issue in expand_vector_comparison [PR104307]
authorJakub Jelinek <jakub@redhat.com>
Tue, 1 Feb 2022 15:02:54 +0000 (16:02 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 19 Feb 2022 08:01:32 +0000 (09:01 +0100)
commitc81d1a061e5cfab6bd276c5be4cd6161b11e6d44
tree97d18b25cc1569b7ef9033da29e094b663de5387
parent73b30d18a04bd6efa7e25c28dac1c863dc1cb06e
veclower: Fix up -fcompare-debug issue in expand_vector_comparison [PR104307]

The following testcase fails -fcompare-debug, because expand_vector_comparison
since r11-1786-g1ac9258cca8030745d3c0b8f63186f0adf0ebc27 sets
vec_cond_expr_only when it sees some use other than VEC_COND_EXPR that uses
the lhs in its condition.
Obviously we should ignore debug stmts when doing so, e.g. by not pushing
them to uses.
That would be a 2 liner change, but while looking at it, I'm also worried
about VEC_COND_EXPRs that would use the lhs in more than one operand,
like VEC_COND_EXPR <lhs, lhs, something> or VEC_COND_EXPR <lhs, something, lhs>
(sure, they ought to be folded, but what if they weren't).  Because if
something like that happens, then FOR_EACH_IMM_USE_FAST would push the same
stmt multiple times and expand_vector_condition can return true even when
it modifies it (for vector bool masking).
And lastly, it seems quite wasteful to safe_push statements that will just
cause vec_cond_expr_only = false; and break; in the second loop, both for
cases like 1000 immediate non-VEC_COND_EXPR uses and for cases like
999 VEC_COND_EXPRs with lhs in cond followed by a single non-VEC_COND_EXPR
use.  So this patch only pushes VEC_COND_EXPRs there.

2022-02-01  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/104307
* tree-vect-generic.c (expand_vector_comparison): Don't push debug
stmts to uses vector, just set vec_cond_expr_only to false for
non-VEC_COND_EXPRs instead of pushing them into uses.  Treat
VEC_COND_EXPRs that use lhs not just in rhs1, but rhs2 or rhs3 too
like non-VEC_COND_EXPRs.

* gcc.target/i386/pr104307.c: New test.

(cherry picked from commit e9bf6d6b0e1d67df6dcee042fbe37ab72c3a38d7)
gcc/testsuite/gcc.target/i386/pr104307.c [new file with mode: 0644]
gcc/tree-vect-generic.c
This page took 0.05853 seconds and 5 git commands to generate.