diff options
author | Jakub Jelinek <jakub@redhat.com> | 2021-04-16 11:44:04 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2021-04-16 11:44:04 +0200 |
commit | b44ab138b7d4aaa5a9ee7956121ffc94777f6a42 (patch) | |
tree | de616a5300051aa39d3ce428b885f0beb71de4cf /gcc/builtins.c | |
parent | 784de5292c34e287c848b382b431599b818ea76e (diff) | |
download | gcc-b44ab138b7d4aaa5a9ee7956121ffc94777f6a42.zip gcc-b44ab138b7d4aaa5a9ee7956121ffc94777f6a42.tar.gz gcc-b44ab138b7d4aaa5a9ee7956121ffc94777f6a42.tar.bz2 |
vectorizer: Remove dead scalar .COND_* calls from vectorized loops [PR99767]
The following testcase ICEs because disabling of DCE means there are dead
stmts in the loop (though, in theory they could become dead only shortly
before if-conv through some optimization), ifcvt which goes through all
stmts in the loop if-converts them into .COND_DIV etc. internal fn calls
in the copy of the loop meant for vectorization only, the loop is
successfully vectorized but the particular .COND_* call is not because
it isn't a live statement and the scalar .COND_* remains in the IL until
expansion where it ICEs because these ifns only support vectors and not
scalars.
These ifns are similar to .MASK_{LOAD,STORE} in this behavior.
One possible fix could be to expand scalar versions of them during
expansion, basically undoing what if-conv did to create them, i.e.
expand them as the lhs = else; if (mask) { lhs = statement; } or so.
For .MASK_LOAD we have code to replace them in vect_transform_loop already
though (not needed for .MASK_STORE, as stores should be always live
and thus always vectorized), so this patch instead replaces .COND_*
similarly to .MASK_LOAD in that loop, with the small difference
that lhs = .MASK_LOAD (...); is replaced by lhs = 0; while
lhs = .COND_* (..., else_arg); is replaced by lhs = else_arg.
The statement must be dead, otherwise it would be vectorized, so I think
it is not a big deal we don't turn it back into multiple basic blocks etc.
(and it might be not possible to do that at that point).
2021-04-16 Jakub Jelinek <jakub@redhat.com>
PR target/99767
* tree-vect-loop.c (vect_transform_loop): Don't remove just
dead scalar .MASK_LOAD calls, but also dead .COND_* calls - replace
them by their last argument.
* gcc.target/aarch64/pr99767.c: New test.
Diffstat (limited to 'gcc/builtins.c')
0 files changed, 0 insertions, 0 deletions