]> git.ipfire.org Git - thirdparty/gcc.git/commit
ipa-sra: Don't change return type to void if there are musttail calls [PR119484]
authorJakub Jelinek <jakub@redhat.com>
Fri, 28 Mar 2025 09:48:31 +0000 (10:48 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Fri, 28 Mar 2025 09:48:31 +0000 (10:48 +0100)
commitc95f5a0c0719ad5b23f605b4d8f8dd3689a0066b
treeadf3d4635bb8c0b4018af0ba166f1c59ebe5e881
parent9ac0ff5ea5f5a2c96f1599d271a42e226929d30b
ipa-sra: Don't change return type to void if there are musttail calls [PR119484]

The following testcase is rejected, because IPA-SRA decides to
turn bar.constprop call into bar.constprop.isra which returns void.
While there is no explicit lhs on the call, as it is a musttail call
the tailc pass checks if IPA-VRP returns singleton from that function
and the function returns the same value and in that case it still turns
it into a tail call.  This can't work with IPA-SRA changing it into
void returning function though.

The following patch fixes this by forcing returning the original type
if there are musttail calls.

2025-03-28  Jakub Jelinek  <jakub@redhat.com>

PR ipa/119484
* ipa-sra.cc (isra_analyze_call): Don't set m_return_ignored if
gimple_call_must_tail_p even if it doesn't have lhs.

* c-c++-common/pr119484.c: New test.
gcc/ipa-sra.cc
gcc/testsuite/c-c++-common/pr119484.c [new file with mode: 0644]