diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2024-07-12 15:50:36 +0100 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2024-07-12 15:50:36 +0100 |
commit | 6e7053a641393211f52c176e540c8922288ab8db (patch) | |
tree | 7f229d3848f47fbf982d7dd60ba295c62662d785 /libcpp/include | |
parent | f4047a8614d2215e0d6acf071c521ac08ab1bbb2 (diff) | |
download | gcc-6e7053a641393211f52c176e540c8922288ab8db.zip gcc-6e7053a641393211f52c176e540c8922288ab8db.tar.gz gcc-6e7053a641393211f52c176e540c8922288ab8db.tar.bz2 |
rtl-ssa: Fix prev_any_insn [PR115785]
Bit of a brown paper bag issue, but: due to the representation
of the insn chain, insn_info::prev_any_insn would sometimes skip
over instructions. This led to an invalid update in the PR when
adding and removing instructions.
I think one of the reasons I failed to spot this when checking
the code is that m_prev_insn_or_last_debug_insn is misnamed:
it's the previous instruction *of the same type* or the last
debug instruction in a group. The patch therefore renames it to
m_prev_sametype_or_last_debug_insn (with the term prev_sametype
already being used in some accessors).
The reason this didn't show up earlier is that (a) prev_any_insn
is rarely used directly, (b) no instructions were lost from the
def-use chains, and (c) only consecutive debug instructions were
skipped when walking the insn chain.
The chaining scheme makes prev_any_insn more complicated than
next_any_insn, prev_nondebug_insn and next_nondebug_insn, but the
object code produced is still relatively simple.
gcc/
PR rtl-optimization/115785
* rtl-ssa/insns.h (insn_info::prev_insn_or_last_debug_insn)
(insn_info::next_nondebug_or_debug_insn): Remove typedefs.
(insn_info::m_prev_insn_or_last_debug_insn): Rename to...
(insn_info::m_prev_sametype_or_last_debug_insn): ...this.
* rtl-ssa/internals.inl (insn_info::insn_info): Update after
above renaming.
(insn_info::copy_prev_from): Likewise.
(insn_info::set_prev_sametype_insn): Likewise.
(insn_info::set_last_debug_insn): Likewise.
(insn_info::clear_insn_links): Likewise.
(insn_info::has_insn_links): Likewise.
* rtl-ssa/member-fns.inl (insn_info::prev_nondebug_insn): Likewise.
(insn_info::prev_any_insn): Fix moves from non-debug to debug insns.
gcc/testsuite/
PR rtl-optimization/115785
* g++.dg/torture/pr115785.C: New test.
Diffstat (limited to 'libcpp/include')
0 files changed, 0 insertions, 0 deletions