re PR rtl-optimization/88018 (ICE in insert_insn_on_edge at cfgrtl.c:1952 since r255066)
authorJakub Jelinek <jakub@redhat.com>
Thu, 15 Nov 2018 08:47:21 +0000 (09:47 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 15 Nov 2018 08:47:21 +0000 (09:47 +0100)
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

gcc/ChangeLog
gcc/cfgrtl.c
gcc/testsuite/ChangeLog

index 174ee432c4fa98f668517c5d7be7d97f0faeb810..4bf430757dca783cc480176c16d876ebaff5613f 100644 (file)
@@ -1,3 +1,9 @@
+2018-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <rguenther@suse.de>
 
        PR middle-end/87917
index 741a3120a971cbc8f9fa7c6cff442c4b76ece4ba..3d4a114cbbb9d5a674f01a3f526490d089e7b381 100644 (file)
@@ -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 ();
index 0bcd8e0711f4ca9467a0351266a55995ef473855..3c6c47f6766c671b5f669affbb68c920c43dcb9d 100644 (file)
@@ -1,3 +1,8 @@
+2018-11-15  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/88018
+       * g++.dg/tsan/pr88018.C: New test.
+
 2018-11-15  Richard Biener  <rguenther@suse.de>
 
        PR middle-end/87917