diff options
author | Jakub Jelinek <jakub@redhat.com> | 2011-11-05 20:58:37 +0100 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2011-11-05 20:58:37 +0100 |
commit | 5619e52cfbe12a8a664ef49ef44043a739b54880 (patch) | |
tree | 7b028a77e2bfe16e21bef7282ea5fce54ee5d004 /gcc/config | |
parent | eed33268ffda4b25ae8d756d9e91a3425d5e96f4 (diff) | |
download | gcc-5619e52cfbe12a8a664ef49ef44043a739b54880.zip gcc-5619e52cfbe12a8a664ef49ef44043a739b54880.tar.gz gcc-5619e52cfbe12a8a664ef49ef44043a739b54880.tar.bz2 |
re PR tree-optimization/50693 (Loop optimization restricted by GOTOs)
PR tree-optimization/50693
* tree-cfg.c (gimple_can_merge_blocks_p): Allow merging with
non-forced user labels.
(gimple_merge_blocks): Turn non-forced user labels into
debug bind stmt with the label as first operand and reset value.
(gimple_duplicate_bb): Don't duplicate label debug stmts.
* dwarf2out.c (gen_label_die): Handle NOTE_INSN_DELETED_DEBUG_LABEL.
* final.c (final_scan_insn): Likewise.
(rest_of_clean_state): Don't dump NOTE_INSN_DELETED_DEBUG_LABEL.
* var-tracking.c (debug_label_num): New variable.
(delete_debug_insns): Don't delete DEBUG_INSNs for LABEL_DECLs,
instead turn them into NOTE_INSN_DELETED_DEBUG_LABEL notes.
* cfglayout.c (skip_insns_after_block, duplicate_insn_chain): Handle
NOTE_INSN_DELETED_DEBUG_LABEL.
(duplicate_insn_chain): Don't duplicate LABEL_DECL DEBUG_INSNs.
* insn-notes.def (DELETED_DEBUG_LABEL): New note kind.
* print-rtl.c (print_rtx): Handle NOTE_INSN_DELETED_DEBUG_LABEL.
* gengtype.c (adjust_field_rtx_def): Likewise.
* config/i386/i386.c (ix86_output_function_epilogue): For MachO
clear CODE_LABEL_NUMBER of NOTE_INSN_DELETED_DEBUG_LABEL
if their are at the end of function and nop hasn't been emitted.
* config/rs6000/rs6000.c (rs6000_output_function_epilogue): Likewise.
From-SVN: r181014
Diffstat (limited to 'gcc/config')
-rw-r--r-- | gcc/config/i386/i386.c | 15 | ||||
-rw-r--r-- | gcc/config/rs6000/rs6000.c | 15 |
2 files changed, 28 insertions, 2 deletions
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fb0ac8d..ca62b22 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -10879,15 +10879,28 @@ ix86_output_function_epilogue (FILE *file ATTRIBUTE_UNUSED, it looks like we might want one, insert a NOP. */ { rtx insn = get_last_insn (); + rtx deleted_debug_label = NULL_RTX; while (insn && NOTE_P (insn) && NOTE_KIND (insn) != NOTE_INSN_DELETED_LABEL) - insn = PREV_INSN (insn); + { + /* Don't insert a nop for NOTE_INSN_DELETED_DEBUG_LABEL + notes only, instead set their CODE_LABEL_NUMBER to -1, + otherwise there would be code generation differences + in between -g and -g0. */ + if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL) + deleted_debug_label = insn; + insn = PREV_INSN (insn); + } if (insn && (LABEL_P (insn) || (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED_LABEL))) fputs ("\tnop\n", file); + else if (deleted_debug_label) + for (insn = deleted_debug_label; insn; insn = NEXT_INSN (insn)) + if (NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL) + CODE_LABEL_NUMBER (insn) = -1; } #endif diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 86fe859..779086a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -21461,15 +21461,28 @@ rs6000_output_function_epilogue (FILE *file, it looks like we might want one, insert a NOP. */ { rtx insn = get_last_insn (); + rtx deleted_debug_label = NULL_RTX; while (insn && NOTE_P (insn) && NOTE_KIND (insn) != NOTE_INSN_DELETED_LABEL) - insn = PREV_INSN (insn); + { + /* Don't insert a nop for NOTE_INSN_DELETED_DEBUG_LABEL + notes only, instead set their CODE_LABEL_NUMBER to -1, + otherwise there would be code generation differences + in between -g and -g0. */ + if (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL) + deleted_debug_label = insn; + insn = PREV_INSN (insn); + } if (insn && (LABEL_P (insn) || (NOTE_P (insn) && NOTE_KIND (insn) == NOTE_INSN_DELETED_LABEL))) fputs ("\tnop\n", file); + else if (deleted_debug_label) + for (insn = deleted_debug_label; insn; insn = NEXT_INSN (insn)) + if (NOTE_KIND (insn) == NOTE_INSN_DELETED_DEBUG_LABEL) + CODE_LABEL_NUMBER (insn) = -1; } #endif |