diff options
author | Jakub Jelinek <jakub@redhat.com> | 2018-03-20 22:07:13 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2018-03-20 22:07:13 +0100 |
commit | 6f21dc3c4f987a9d4abd3b0c1c46d8d8a16a3465 (patch) | |
tree | 468156d990c6bc0e8476053962782e524467b5c4 /gcc | |
parent | 1efb1dc2d893db2fa8f15945d506410aab628b60 (diff) | |
download | gcc-6f21dc3c4f987a9d4abd3b0c1c46d8d8a16a3465.zip gcc-6f21dc3c4f987a9d4abd3b0c1c46d8d8a16a3465.tar.gz gcc-6f21dc3c4f987a9d4abd3b0c1c46d8d8a16a3465.tar.bz2 |
re PR debug/84875 (ICE in maybe_record_trace_start, at dwarf2cfi.c:2348 on s390x)
PR debug/84875
* dce.c (delete_unmarked_insns): Don't remove frame related noop moves
holding REG_CFA_RESTORE notes, instead turn them into a USE.
* gcc.dg/pr84875.c: New test.
From-SVN: r258692
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/dce.c | 27 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr84875.c | 28 |
4 files changed, 63 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1684757..f604631 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-03-20 Jakub Jelinek <jakub@redhat.com> + + PR debug/84875 + * dce.c (delete_unmarked_insns): Don't remove frame related noop moves + holding REG_CFA_RESTORE notes, instead turn them into a USE. + 2018-03-20 Peter Bergner <bergner@vnet.ibm.com> PR target/83789 @@ -569,9 +569,19 @@ delete_unmarked_insns (void) FOR_BB_INSNS_REVERSE_SAFE (bb, insn, next) if (NONDEBUG_INSN_P (insn)) { + rtx turn_into_use = NULL_RTX; + /* Always delete no-op moves. */ if (noop_move_p (insn)) - ; + { + if (RTX_FRAME_RELATED_P (insn)) + turn_into_use + = find_reg_note (insn, REG_CFA_RESTORE, NULL); + if (turn_into_use && REG_P (XEXP (turn_into_use, 0))) + turn_into_use = XEXP (turn_into_use, 0); + else + turn_into_use = NULL_RTX; + } /* Otherwise rely only on the DCE algorithm. */ else if (marked_insn_p (insn)) @@ -611,8 +621,19 @@ delete_unmarked_insns (void) if (CALL_P (insn)) must_clean = true; - /* Now delete the insn. */ - delete_insn_and_edges (insn); + if (turn_into_use) + { + /* Don't remove frame related noop moves if they cary + REG_CFA_RESTORE note, while we don't need to emit any code, + we need it to emit the CFI restore note. */ + PATTERN (insn) + = gen_rtx_USE (GET_MODE (turn_into_use), turn_into_use); + INSN_CODE (insn) = -1; + df_insn_rescan (insn); + } + else + /* Now delete the insn. */ + delete_insn_and_edges (insn); } /* Deleted a pure or const call. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index edef059..79cc52c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-03-20 Jakub Jelinek <jakub@redhat.com> + + PR debug/84875 + * gcc.dg/pr84875.c: New test. + 2018-03-20 Marek Polacek <polacek@redhat.com> PR c++/84978, ICE with NRVO. diff --git a/gcc/testsuite/gcc.dg/pr84875.c b/gcc/testsuite/gcc.dg/pr84875.c new file mode 100644 index 0000000..257176d --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr84875.c @@ -0,0 +1,28 @@ +/* PR debug/84875 */ +/* { dg-do compile } */ +/* { dg-options "-Os" } */ +/* { dg-additional-options "-fpie" { target pie } } */ +/* { dg-additional-options "-march=z196" { target s390*-*-* } } */ + +static long *a[100]; +static int b[100]; +long *c; +int d; +void foo (long *); + +void +bar () +{ + long *g = c; + g--; + d = *g; + if (d) + if (b[d] < 8) + { + *(void **)g = a[d]; + a[d] = g; + b[d]++; + return; + } + foo (g); +} |