rtl-ssa: Fix updates to call clobbers [PR98403]
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Jan 2021 11:04:15 +0000 (11:04 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Tue, 5 Jan 2021 11:04:15 +0000 (11:04 +0000)
commit8a25be517f8de8c060705da13db283a268cf6d12
tree828037944a89e09662b156b3490b2be83af98eb0
parent01be45eccee42d0cc6c900f43e2363186517f7ed
rtl-ssa: Fix updates to call clobbers [PR98403]

In the PR, fwprop was changing a call instruction and tripped
an assert when trying to update a list of call clobbers.
There are two ways we could handle this: remove the call clobber
and then add it back, or assume that the clobber will stay in its
current place.

At the moment we don't have enough information to safely move
calls around, so the second approach seems simpler and more
efficient.

gcc/
PR rtl-optimization/98403
* rtl-ssa/changes.cc (function_info::finalize_new_accesses): Explain
why we don't remove call clobbers.
(function_info::apply_changes_to_insn): Don't attempt to add
call clobbers here.

gcc/testsuite/
PR rtl-optimization/98403
* g++.dg/opt/pr98403.C: New test.
gcc/rtl-ssa/changes.cc
gcc/testsuite/g++.dg/opt/pr98403.C [new file with mode: 0644]