combine: Make code after a new trap unreachable (PR78342)

Programming / Compilers / GCC - segher [138bc75d-0d04-0410-961f-82ee72b054a4] - 28 November 2016 20:02 UTC

Combine can turn a conditional trap into an unconditional trap. If it does that it should make the code after it unreachable (an unconditional trap should be the last insn in its bb, and that bb has no successors).

This patch seems to work. It is hard to be sure, this is very hard to trigger. Quite a few other passes look like they need something similar as well, but I don't see anything else handling it yet either.


PR rtl-optimization/78342
- combine.c: Include "cfghooks.h". (try_combine): If we create an unconditional trap, break the basic block in two just after it, and remove the edge between; also, set the *new_direct_jump_p flag so that cleanup_cfg is run.

1938afa combine: Make code after a new trap unreachable (PR78342)
gcc/ChangeLog | 8 ++++++++
gcc/combine.c | 20 ++++++++++++++++++++
2 files changed, 28 insertions(+)

Upstream: gcc.gnu.org


  • Share