From f46294817200cf2f07112eb8b53b814b1ed936b7 Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 2 Aug 2017 15:58:08 +0200 Subject: [PATCH] re PR target/81644 (ICE in rtl_verify_bb_insn, BBRO pass duplicates BB that ends with flow control insn) 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 | 8 ++++++++ gcc/config/i386/i386.c | 2 +- gcc/config/i386/i386.md | 13 +++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.target/i386/pr81644.c | 15 +++++++++++++++ 5 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr81644.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e6a464973fb..025d8fabb36 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-08-02 Uros Bizjak + + 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 PR other/81667 diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index cd20b1be6ec..a5984659eb2 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -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; } diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md index 5eff4e46fff..3465312ef4b 100644 --- a/gcc/config/i386/i386.md +++ b/gcc/config/i386/i386.md @@ -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") diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c28019bf33a..9fd6be4afa2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-08-02 Uros Bizjak + + PR target/81644 + * gcc.target/i386/pr81644.c: New test. + 2017-08-02 Tom de Vries * 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 index 00000000000..61f94a409ff --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr81644.c @@ -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 (); +} -- 2.30.2