From: jakub Date: Thu, 15 Nov 2018 08:47:21 +0000 (+0000) Subject: PR rtl-optimization/88018 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a3f619a1b40509a8df861e0e4426e3967d8c5e66;p=thirdparty%2Fgcc.git 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266174 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 174ee432c4fa..4bf430757dca 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-11-15 Jakub Jelinek + + 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. + 2018-11-15 Richard Biener PR middle-end/87917 diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index 741a3120a971..3d4a114cbbb9 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 (); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0bcd8e0711f4..3c6c47f6766c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-15 Jakub Jelinek + + PR rtl-optimization/88018 + * g++.dg/tsan/pr88018.C: New test. + 2018-11-15 Richard Biener PR middle-end/87917