From 8ec0963c81b2023596d1c9913571c2c462f06796 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Wed, 16 Dec 2015 09:04:31 +0100 Subject: [PATCH] re PR rtl-optimization/65980 (-fcompare-debug failure building Linux kernel) PR rtl-optimization/65980 * jump.c (rtx_renumbered_equal_p) : Use next_nonnote_nondebug_insn instead of next_real_insn and skip over CODE_LABELs too. * gcc.dg/pr65980.c: New test. From-SVN: r231672 --- gcc/ChangeLog | 7 +++++++ gcc/jump.c | 12 ++++++++++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr65980.c | 30 ++++++++++++++++++++++++++++++ 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr65980.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ad50192a923..c68fd132e34 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2015-12-16 Jakub Jelinek + + PR rtl-optimization/65980 + * jump.c (rtx_renumbered_equal_p) : Use + next_nonnote_nondebug_insn instead of next_real_insn and + skip over CODE_LABELs too. + 2015-12-10 Jan Hubicka * symtab.c (symtab_node::fixup_same_cpp_alias_visibility): diff --git a/gcc/jump.c b/gcc/jump.c index c41710db73d..79188f4bc65 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -1802,8 +1802,16 @@ rtx_renumbered_equal_p (const_rtx x, const_rtx y) /* Two label-refs are equivalent if they point at labels in the same position in the instruction stream. */ - return (next_real_insn (LABEL_REF_LABEL (x)) - == next_real_insn (LABEL_REF_LABEL (y))); + else + { + rtx_insn *xi = next_nonnote_nondebug_insn (LABEL_REF_LABEL (x)); + rtx_insn *yi = next_nonnote_nondebug_insn (LABEL_REF_LABEL (y)); + while (xi && LABEL_P (xi)) + xi = next_nonnote_nondebug_insn (xi); + while (yi && LABEL_P (yi)) + yi = next_nonnote_nondebug_insn (yi); + return xi == yi; + } case SYMBOL_REF: return XSTR (x, 0) == XSTR (y, 0); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7e45765159c..a0b8fda8b3c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-16 Jakub Jelinek + + PR rtl-optimization/65980 + * gcc.dg/pr65980.c: New test. + 2015-12-15 Martin Sebor c++/42121 diff --git a/gcc/testsuite/gcc.dg/pr65980.c b/gcc/testsuite/gcc.dg/pr65980.c new file mode 100644 index 00000000000..5139ae36145 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65980.c @@ -0,0 +1,30 @@ +/* PR rtl-optimization/65980 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -fcompare-debug" } */ + +typedef struct { int b; } A; +void (*a) (int); +int b; + +int +foo (A *v) +{ + asm goto ("" : : "m" (v->b) : : l); + return 0; +l: + return 1; +} + +int +bar (void) +{ + if (b) + { + if (foo (0) && a) + a (0); + return 0; + } + if (foo (0) && a) + a (0); + return 0; +}