summaryrefslogtreecommitdiff
path: root/gcc/cfgrtl.c
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2018-11-15 09:47:21 +0100
committerJakub Jelinek <jakub@gcc.gnu.org>2018-11-15 09:47:21 +0100
commit3df45f179a29e223d795502b80c1a877bca47a14 (patch)
tree798e8b51907ec9f74ec6e2dec464b2fa447733ee /gcc/cfgrtl.c
parentef0519fd4f688558fe2de79e741529655724478d (diff)
downloadgcc-3df45f179a29e223d795502b80c1a877bca47a14.tar.gz
re PR rtl-optimization/88018 (ICE in insert_insn_on_edge at cfgrtl.c:1952 since r255066)
PR rtl-optimization/88018 * cfgrtl.c (fixup_abnormal_edges): Guard moving insns to fallthru edge on the presence of fallthru edge, rather than if it is a USE or not. * g++.dg/tsan/pr88018.C: New test. From-SVN: r266174
Diffstat (limited to 'gcc/cfgrtl.c')
-rw-r--r--gcc/cfgrtl.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 741a3120a97..3d4a114cbbb 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -3332,8 +3332,15 @@ fixup_abnormal_edges (void)
If it's placed after a trapping call (i.e. that
call is the last insn anyway), we have no fallthru
edge. Simply delete this use and don't try to insert
- on the non-existent edge. */
- if (GET_CODE (PATTERN (insn)) != USE)
+ on the non-existent edge.
+ Similarly, sometimes a call that can throw is
+ followed in the source with __builtin_unreachable (),
+ meaning that there is UB if the call returns rather
+ than throws. If there weren't any instructions
+ following such calls before, supposedly even the ones
+ we've deleted aren't significant and can be
+ removed. */
+ if (e)
{
/* We're not deleting it, we're moving it. */
insn->set_undeleted ();