From: Alexandre Oliva Date: Tue, 16 Apr 2019 12:44:57 +0000 (+0000) Subject: [PR89528] reset debug uses of return value when dropping dead RTL call X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2689fcc80e2e34bf88f03c4ee69d31d9c8dcc368;p=gcc.git [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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ebd9c8f3f2..5f007efe75e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-04-16 Alexandre Oliva + + 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 * config/arc/arc-protos.h (arc_register_move_cost): Remove. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7dc4f7411b6..914e5776867 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2019-04-16 Alexandre Oliva + PR debug/89528 + * gcc.dg/guality/pr89528.c: New. + PR rtl-optimization/86438 * gcc.dg/torture/pr86438.c: Split up too-wide shift. diff --git a/gcc/testsuite/gcc.dg/guality/pr89528.c b/gcc/testsuite/gcc.dg/guality/pr89528.c new file mode 100644 index 00000000000..04a7e84d875 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr89528.c @@ -0,0 +1,25 @@ +/* PR debug/89528 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ + +#include + +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(); } diff --git a/gcc/valtrack.c b/gcc/valtrack.c index 9b2bb333c0a..1f67378a867 100644 --- a/gcc/valtrack.c +++ b/gcc/valtrack.c @@ -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; }