re PR target/81644 (ICE in rtl_verify_bb_insn, BBRO pass duplicates BB that ends...
authorUros Bizjak <ubizjak@gmail.com>
Wed, 2 Aug 2017 13:58:08 +0000 (15:58 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Wed, 2 Aug 2017 13:58:08 +0000 (15:58 +0200)
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.

From-SVN: r250830

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/config/i386/i386.md
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr81644.c [new file with mode: 0644]

index e6a464973fbecdbceb5c744864f41c929a46b040..025d8fabb36e3f0f38cab329676a66f948cabf5d 100644 (file)
@@ -1,3 +1,11 @@
+2017-08-02  Uros Bizjak  <ubizjak@gmail.com>
+
+       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.
+
 2017-08-02  Marek Polacek  <polacek@redhat.com>
 
        PR other/81667
index cd20b1be6ec09d2b3973b2684d3a42c8b4ff44a6..a5984659eb2d79d2cac9236ebc6426e26114a26f 100644 (file)
@@ -15199,7 +15199,7 @@ ix86_expand_epilogue (int style)
   if (ix86_function_naked (current_function_decl))
     {
       /* The program should not reach this point.  */
-      emit_insn (gen_trap ());
+      emit_insn (gen_ud2 ());
       return;
     }
 
index 5eff4e46fff3071dade314801ed22062bae50ab8..3465312ef4b5fbfc6503637f697a2ce4f50f0a06 100644 (file)
 ])
 
 (define_c_enum "unspecv" [
+  UNSPECV_UD2
   UNSPECV_BLOCKAGE
   UNSPECV_STACK_PROBE
   UNSPECV_PROBE_STACK_RANGE
 }
   [(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")
index c28019bf33a0226bc28bbd9e952a25363d2dfaff..9fd6be4afa2f5811f046f48b5528e3a39d13b3c9 100644 (file)
@@ -1,3 +1,8 @@
+2017-08-02  Uros Bizjak  <ubizjak@gmail.com>
+
+       PR target/81644
+       * gcc.target/i386/pr81644.c: New test.
+
 2017-08-02  Tom de Vries  <tom@codesourcery.com>
 
        * gcc.dg/Walloca-14.c: Use relative line number.
diff --git a/gcc/testsuite/gcc.target/i386/pr81644.c b/gcc/testsuite/gcc.target/i386/pr81644.c
new file mode 100644 (file)
index 0000000..61f94a4
--- /dev/null
@@ -0,0 +1,15 @@
+/* PR target/81644 */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-additional-options "-mregparm=1" { target ia32 } } */
+
+void b (void);
+
+void
+__attribute__ ((naked))
+a (int z)
+{
+  if (z)
+    return;
+  b ();
+}