[Bug target/81644] ICE in rtl_verify_bb_insn, BBRO pass duplicates BB that ends with flow control insn

2017-09-13 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81644

--- Comment #5 from Aldy Hernandez  ---
Author: aldyh
Date: Wed Sep 13 16:21:52 2017
New Revision: 252260

URL: https://gcc.gnu.org/viewcvs?rev=252260&root=gcc&view=rev
Log:
PR target/81644
* config/i386/i386.md (unspecv): Add UNSPECV_UD2.
(ud2): New insn pattern.
* config/i386/i386.c (ix86_expand_epilogue):
Generate ud2 instead of trap insn.

testsuite/ChangeLog:

PR target/81644
* gcc.target/i386/pr81644.c: New test.

Added:
branches/range-gen2/gcc/testsuite/gcc.target/i386/pr81644.c
Modified:
branches/range-gen2/gcc/ChangeLog
branches/range-gen2/gcc/config/i386/i386.c
branches/range-gen2/gcc/config/i386/i386.md
branches/range-gen2/gcc/testsuite/ChangeLog

[Bug target/81644] ICE in rtl_verify_bb_insn, BBRO pass duplicates BB that ends with flow control insn

2017-08-02 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81644

Uroš Bizjak  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 Resolution|--- |FIXED
   Assignee|unassigned at gcc dot gnu.org  |ubizjak at gmail dot com

--- Comment #4 from Uroš Bizjak  ---
Fixed (... or worked around) for gcc-8.

[Bug target/81644] ICE in rtl_verify_bb_insn, BBRO pass duplicates BB that ends with flow control insn

2017-08-02 Thread uros at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81644

--- Comment #3 from uros at gcc dot gnu.org ---
Author: uros
Date: Wed Aug  2 13:58:08 2017
New Revision: 250830

URL: https://gcc.gnu.org/viewcvs?rev=250830&root=gcc&view=rev
Log:
PR target/81644
* config/i386/i386.md (unspecv): Add UNSPECV_UD2.
(ud2): New insn pattern.
* config/i386/i386.c (ix86_expand_epilogue):
Generate ud2 instead of trap insn.

testsuite/ChangeLog:

PR target/81644
* gcc.target/i386/pr81644.c: New test.


Added:
trunk/gcc/testsuite/gcc.target/i386/pr81644.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/config/i386/i386.c
trunk/gcc/config/i386/i386.md
trunk/gcc/testsuite/ChangeLog

[Bug target/81644] ICE in rtl_verify_bb_insn, BBRO pass duplicates BB that ends with flow control insn

2017-08-02 Thread ubizjak at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81644

Uroš Bizjak  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-08-02
  Component|rtl-optimization|target
   Target Milestone|--- |8.0
 Ever confirmed|0   |1

--- Comment #2 from Uroš Bizjak  ---
It turned out we can't simply emit trap insn during epilogue expansion, since
epilogue is expanded on FALLTHRU edge to EXIT BB. Later passes rightfully choke
on control flow insn in BB with FALTHRU exit edge.

I'm testing the following patch:

--cut here--
Index: config/i386/i386.c
===
--- config/i386/i386.c  (revision 250818)
+++ config/i386/i386.c  (working copy)
@@ -15199,7 +15199,7 @@
   if (ix86_function_naked (current_function_decl))
 {
   /* The program should not reach this point.  */
-  emit_insn (gen_trap ());
+  emit_insn (gen_ud2 ());
   return;
 }

Index: config/i386/i386.md
===
--- config/i386/i386.md (revision 250818)
+++ config/i386/i386.md (working copy)
@@ -201,6 +201,7 @@
 ])

 (define_c_enum "unspecv" [
+  UNSPECV_UD2
   UNSPECV_BLOCKAGE
   UNSPECV_STACK_PROBE
   UNSPECV_PROBE_STACK_RANGE
@@ -18606,6 +18607,18 @@
 }
   [(set_attr "length" "2")])

+(define_insn "ud2"
+  [(unspec_volatile [(const_int 0)] UNSPECV_UD2)]
+  ""
+{
+#ifdef HAVE_AS_IX86_UD2
+  return "ud2";
+#else
+  return ASM_SHORT "0x0b0f";
+#endif
+}
+  [(set_attr "length" "2")])
+
 (define_expand "prefetch"
   [(prefetch (match_operand 0 "address_operand")
 (match_operand:SI 1 "const_int_operand")
--cut here--