From f5d30aa62f848a163193ac95e4e0f26aa8383d92 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Thu, 29 Nov 2012 00:01:03 +0100 Subject: re PR debug/36728 ([stack]: gdb doesn't work with stack alignment) PR debug/36728 PR debug/55467 PR middle-end/55507 PR bootstrap/55511 * cselib.c (cselib_process_insn): If cselib_preserve_constants, don't reset table and exit early on volatile insns and setjmp. Reset table afterwards on setjmp. * gcc.dg/guality/pr36728-1.c: Include "../nop.h", make sure the asm are non-empty and add dependency between the first and second asm. * gcc.dg/guality/pr36728-2.c: Likewise. * gcc.dg/guality/pr36728-3.c: New test. * gcc.dg/guality/pr36728-4.c: New test. From-SVN: r193911 --- gcc/cselib.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'gcc/cselib.c') diff --git a/gcc/cselib.c b/gcc/cselib.c index 198be8a..a2f60ec 100644 --- a/gcc/cselib.c +++ b/gcc/cselib.c @@ -2626,11 +2626,12 @@ cselib_process_insn (rtx insn) cselib_current_insn = insn; /* Forget everything at a CODE_LABEL, a volatile insn, or a setjmp. */ - if (LABEL_P (insn) - || (CALL_P (insn) - && find_reg_note (insn, REG_SETJMP, NULL)) - || (NONJUMP_INSN_P (insn) - && volatile_insn_p (PATTERN (insn)))) + if ((LABEL_P (insn) + || (CALL_P (insn) + && find_reg_note (insn, REG_SETJMP, NULL)) + || (NONJUMP_INSN_P (insn) + && volatile_insn_p (PATTERN (insn)))) + && !cselib_preserve_constants) { cselib_reset_table (next_uid); cselib_current_insn = NULL_RTX; @@ -2668,9 +2669,18 @@ cselib_process_insn (rtx insn) /* Look for any CLOBBERs in CALL_INSN_FUNCTION_USAGE, but only after we have processed the insn. */ if (CALL_P (insn)) - for (x = CALL_INSN_FUNCTION_USAGE (insn); x; x = XEXP (x, 1)) - if (GET_CODE (XEXP (x, 0)) == CLOBBER) - cselib_invalidate_rtx (XEXP (XEXP (x, 0), 0)); + { + for (x = CALL_INSN_FUNCTION_USAGE (insn); x; x = XEXP (x, 1)) + if (GET_CODE (XEXP (x, 0)) == CLOBBER) + cselib_invalidate_rtx (XEXP (XEXP (x, 0), 0)); + /* Flush evertything on setjmp. */ + if (cselib_preserve_constants + && find_reg_note (insn, REG_SETJMP, NULL)) + { + cselib_preserve_only_values (); + cselib_reset_table (next_uid); + } + } /* On setter of the hard frame pointer if frame_pointer_needed, invalidate stack_pointer_rtx, so that sp and {,h}fp based -- cgit v1.1