From 99219dba378cab4ad63a338eb9a48f8685940dda Mon Sep 17 00:00:00 2001 From: Andrey Belevantsev Date: Mon, 23 Apr 2018 18:19:06 +0300 Subject: [PATCH] re PR rtl-optimization/85423 (ICE in code_motion_process_successors, at sel-sched.c:6403) PR rtl-optimization/85423 * sel-sched-ir.c (has_dependence_note_mem_dep): Only discard dependencies to debug insns when the previous insn is non-debug. * gcc.dg/pr85423.c: New test. From-SVN: r259563 --- gcc/ChangeLog | 7 +++++++ gcc/sel-sched-ir.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr85423.c | 27 +++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/pr85423.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4dcf45ec9f1..135ac880933 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-04-23 Andrey Belevantsev + + PR rtl-optimization/85423 + + * sel-sched-ir.c (has_dependence_note_mem_dep): Only discard + dependencies to debug insns when the previous insn is non-debug. + 2018-04-23 Claudiu Zissulescu * config/arc/arc.md ("vunspec"): Delete it, unify all the unspec diff --git a/gcc/sel-sched-ir.c b/gcc/sel-sched-ir.c index ee970522890..85ff5bd3eb4 100644 --- a/gcc/sel-sched-ir.c +++ b/gcc/sel-sched-ir.c @@ -3308,7 +3308,7 @@ has_dependence_note_dep (insn_t pro, ds_t ds ATTRIBUTE_UNUSED) that a bookkeeping copy should be movable as the original insn. Detect that here and allow that movement if we allowed it before in the first place. */ - if (DEBUG_INSN_P (real_con) + if (DEBUG_INSN_P (real_con) && !DEBUG_INSN_P (real_pro) && INSN_UID (NEXT_INSN (pro)) == INSN_UID (real_con)) return; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 947b974cab1..0b34bec128f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-04-23 Andrey Belevantsev + + PR rtl-optimization/85423 + * gcc.dg/pr85423.c: New test. + 2018-04-20 Martin Sebor PR c/85365 diff --git a/gcc/testsuite/gcc.dg/pr85423.c b/gcc/testsuite/gcc.dg/pr85423.c new file mode 100644 index 00000000000..2650d86f356 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr85423.c @@ -0,0 +1,27 @@ +/* { dg-do compile { target powerpc*-*-* ia64-*-* i?86-*-* x86_64-*-* } } */ +/* { dg-options "-O2 -fselective-scheduling2 -fvar-tracking-assignments -fno-guess-branch-probability -fno-peephole2 -fno-ssa-phiopt -fno-tree-pre --param max-jump-thread-duplication-stmts=8 -w" } */ +/* { dg-additional-options "-march=nano" { target i?86-*-* x86_64-*-* } } */ + +int vn, xm; + +void +i1 (int); + +void +mb (int *ap, int ev) +{ + while (vn < 1) + { + i1 (vn); + + ev += *ap && ++vn; + + while (xm < 1) + ++xm; + + if (*ap == 0) + *ap = ev; + + ++vn; + } +} -- 2.30.2