From 63f5ad449bbe0a4d478ae9412461e204533a6206 Mon Sep 17 00:00:00 2001 From: jakub Date: Sat, 5 Nov 2011 19:58:37 +0000 Subject: 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181014 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-cfg.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'gcc/tree-cfg.c') diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 2819e7b2fc6..28aea2f6933 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1454,8 +1454,8 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b) break; lab = gimple_label_label (stmt); - /* Do not remove user labels. */ - if (!DECL_ARTIFICIAL (lab)) + /* Do not remove user forced labels. */ + if (!DECL_ARTIFICIAL (lab) && FORCED_LABEL (lab)) return false; } @@ -1701,6 +1701,15 @@ gimple_merge_blocks (basic_block a, basic_block b) gimple_stmt_iterator dest_gsi = gsi_start_bb (a); gsi_insert_before (&dest_gsi, stmt, GSI_NEW_STMT); } + /* Other user labels keep around in a form of a debug stmt. */ + else if (!DECL_ARTIFICIAL (label) && MAY_HAVE_DEBUG_STMTS) + { + gimple dbg = gimple_build_debug_bind (label, + integer_zero_node, + stmt); + gimple_debug_bind_reset_value (dbg); + gsi_insert_before (&gsi, dbg, GSI_SAME_STMT); + } lp_nr = EH_LANDING_PAD_NR (label); if (lp_nr) @@ -5207,6 +5216,12 @@ gimple_duplicate_bb (basic_block bb) if (gimple_code (stmt) == GIMPLE_LABEL) continue; + /* Don't duplicate label debug stmts. */ + if (gimple_debug_bind_p (stmt) + && TREE_CODE (gimple_debug_bind_get_var (stmt)) + == LABEL_DECL) + continue; + /* Create a new copy of STMT and duplicate STMT's virtual operands. */ copy = gimple_copy (stmt); -- cgit v1.2.1 From 6e1c78b5ec698f92f4f8e461630b3f7a6234697e Mon Sep 17 00:00:00 2001 From: jakub Date: Sun, 6 Nov 2011 19:43:32 +0000 Subject: * tree-cfg.c (gimple_can_merge_blocks_p): For -O0 don't remove any user labels. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@181040 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-cfg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-cfg.c') diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 28aea2f6933..7ec50dbabd4 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -1454,8 +1454,8 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b) break; lab = gimple_label_label (stmt); - /* Do not remove user forced labels. */ - if (!DECL_ARTIFICIAL (lab) && FORCED_LABEL (lab)) + /* Do not remove user forced labels or for -O0 any user labels. */ + if (!DECL_ARTIFICIAL (lab) && (!optimize || FORCED_LABEL (lab))) return false; } -- cgit v1.2.1