On Apr 5, 2019, Richard Biener <richard.guent...@gmail.com> wrote: > Looks OK but can you adjust the testcase to actually test > something?
Doh, I *knew* I'd failed to do something I should have ;-) I resorted to the trick you used in pr89892.c, of using a more complex expression to get UNSUPPORTED results instead of FAILs when the call and thus the variable are optimized out. How's this? [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. --- gcc/testsuite/gcc.dg/guality/pr89528.c | 25 +++++++++++++++++++++++++ gcc/valtrack.c | 22 ++++++---------------- 2 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/guality/pr89528.c diff --git a/gcc/testsuite/gcc.dg/guality/pr89528.c b/gcc/testsuite/gcc.dg/guality/pr89528.c new file mode 100644 index 000000000000..04a7e84d8755 --- /dev/null +++ b/gcc/testsuite/gcc.dg/guality/pr89528.c @@ -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(); } diff --git a/gcc/valtrack.c b/gcc/valtrack.c index 9b2bb333c0a3..1f67378a867c 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; } -- Alexandre Oliva, freedom fighter https://FSFLA.org/blogs/lxo Be the change, be Free! FSF Latin America board member GNU Toolchain Engineer Free Software Evangelist Hay que enGNUrecerse, pero sin perder la terGNUra jamás-GNUChe