[PR89528] reset debug uses of return value when dropping dead RTL call

When we remove an RTL call, we wouldn't clean up references to the
return value of the call in debug insns.  Make it so that we do.


for  gcc/ChangeLog

	PR debug/89528
	* valtrack.c (dead_debug_insert_temp): Reset debug references
	to the return value of a call being removed.

for  gcc/testsuite/ChangeLog

	PR debug/89528
	* gcc.dg/guality/pr89528.c: New.

From-SVN: r270389
This commit is contained in:
Alexandre Oliva 2019-04-16 12:44:57 +00:00 committed by Alexandre Oliva
parent 1ce6a0f5b0
commit 2689fcc80e
4 changed files with 40 additions and 16 deletions

View file

@ -1,3 +1,9 @@
2019-04-16 Alexandre Oliva <aoliva@redhat.com>
PR debug/89528
* valtrack.c (dead_debug_insert_temp): Reset debug references
to the return value of a call being removed.
2019-04-16 Claudiu Zissulescu <claziss@synopsys.com>
* config/arc/arc-protos.h (arc_register_move_cost): Remove.

View file

@ -1,5 +1,8 @@
2019-04-16 Alexandre Oliva <aoliva@redhat.com>
PR debug/89528
* gcc.dg/guality/pr89528.c: New.
PR rtl-optimization/86438
* gcc.dg/torture/pr86438.c: Split up too-wide shift.

View file

@ -0,0 +1,25 @@
/* PR debug/89528 */
/* { dg-do run } */
/* { dg-options "-g" } */
#include <stdio.h>
char b;
int d, e;
static int i = 1;
void a(int l) { printf("", l); }
char c(char l) { return l || b && l == 1 ? b : b % l; }
short f(int l, int m) { return l * m; }
short g(short l, short m) { return m || l == 767 && m == 1; }
int h(int l, int m) { return (l ^ m & l ^ (m & 647) - m ^ m) < m; }
static int j(int l) { return d == 0 || l == 647 && d == 1 ? l : l % d; }
short k(int l) { return l >= 2 >> l; }
void optimize_me_not() { asm(""); }
static short n(void) {
int l_1127 = ~j(9 || 0) ^ 65535;
optimize_me_not(); /* { dg-final { gdb-test . "l_1127+1" "-65534" } } */
f(l_1127, i && e ^ 4) && g(0, 0);
e = 0;
return 5;
}
int main() { n(); }

View file

@ -657,22 +657,12 @@ dead_debug_insert_temp (struct dead_debug_local *debug, unsigned int uregno,
{
dest = SET_DEST (set);
src = SET_SRC (set);
/* Lose if the REG-setting insn is a CALL. */
if (GET_CODE (src) == CALL)
{
while (uses)
{
cur = uses->next;
XDELETE (uses);
uses = cur;
}
return 0;
}
/* Asm in DEBUG_INSN is never useful, we can't emit debug info for
that. And for volatile_insn_p, it is actually harmful
- DEBUG_INSNs shouldn't have any side-effects. */
else if (GET_CODE (src) == ASM_OPERANDS
|| volatile_insn_p (src))
/* Reset uses if the REG-setting insn is a CALL. Asm in
DEBUG_INSN is never useful, we can't emit debug info for
that. And for volatile_insn_p, it is actually harmful -
DEBUG_INSNs shouldn't have any side-effects. */
if (GET_CODE (src) == CALL || GET_CODE (src) == ASM_OPERANDS
|| volatile_insn_p (src))
set = NULL_RTX;
}