diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-02-07 10:33:54 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-02-07 10:33:54 +0100 |
commit | cad2412cc84518195fceb2db31e82e6df7e5a2c2 (patch) | |
tree | c3e45aaf363caf42da76d684783421c155b49c88 /gcc/ira.h | |
parent | 64b5ca4345f6a96a8b85b8aa1cfcc9cf667eadfd (diff) | |
download | gcc-cad2412cc84518195fceb2db31e82e6df7e5a2c2.zip gcc-cad2412cc84518195fceb2db31e82e6df7e5a2c2.tar.gz gcc-cad2412cc84518195fceb2db31e82e6df7e5a2c2.tar.bz2 |
cgraph: Handle simd clones in cgraph_node::set_{const,pure}_flag [PR106433]
The following testcase ICEs, because we determine only in late pure const
pass that bar is const (the content of the function loses a store to a
global var during dse3 and read from it during cddce2) and local-pure-const2
makes it const. The cgraph ordering is that post IPA (in late IPA simd
clones are created) bar is processed first, then foo as its caller, then
foo.simdclone* and finally bar.simdclone*. Conceptually I think that is the
right ordering which allows for static simd clones to be removed.
The reason for the ICE is that because bar was marked const, the call to
it lost vops before vectorization, and when we in foo.simdclone* try to
vectorize the call to bar, we replace it with bar.simdclone* which hasn't
been marked const and so needs vops, which we don't add.
Now, because the simd clones are created from the same IL, just in a loop
with different argument/return value passing, I think generally if the base
function is determined to be const or pure, the simd clones should be too,
unless e.g. the vectorization causes different optimization decisions, but
then still the global memory reads if any shouldn't affect what the function
does and global memory stores shouldn't be reachable at runtime.
So, the following patch changes set_{const,pure}_flag to mark also simd
clones.
2023-02-07 Jakub Jelinek <jakub@redhat.com>
PR tree-optimization/106433
* cgraph.cc (set_const_flag_1): Recurse on simd clones too.
(cgraph_node::set_pure_flag): Call set_pure_flag_1 on simd clones too.
* gcc.c-torture/compile/pr106433.c: New test.
Diffstat (limited to 'gcc/ira.h')
0 files changed, 0 insertions, 0 deletions