summaryrefslogtreecommitdiff
path: root/gcc/dce.c
diff options
context:
space:
mode:
authoraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-02 20:06:08 +0000
committeraoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4>2012-10-02 20:06:08 +0000
commitdcd028e121434786998996b4aeb31188b03993a3 (patch)
treec5ddc0d1a51185fc60b47f6189eb5c1a1153d6a4 /gcc/dce.c
parent678c4d016e394dd0c262321c41efc78d6f28cbe9 (diff)
downloadgcc-dcd028e121434786998996b4aeb31188b03993a3.tar.gz
gcc/ChangeLog:
PR debug/54551 * Makefile.in (VALTRACK_H): Add hash-table.h. * valtrack.h: Include hash-table.h. (struct dead_debug_global_entry): New. (struct dead_debug_hash_descr): New. (struct dead_debug_global): New. (struct dead_debug): Rename to... (struct dead_debug_local): ... this. Adjust all uses. (dead_debug_global_init, dead_debug_global_finish): New. (dead_debug_init): Rename to... (dead_debug_local_init): ... this. Adjust all callers. (dead_debug_finish): Rename to... (dead_debug_local_finish): ... this. Adjust all callers. * valtrack.c (dead_debug_global_init): New. (dead_debug_init): Rename to... (dead_debug_local_init): ... this. Take global parameter. Save it and initialize used bitmap from it. (dead_debug_global_find, dead_debug_global_insert): New. (dead_debug_global_replace_temp): New. (dead_debug_promote_uses): New. (dead_debug_finish): Rename to... (dead_debug_local_finish): ... this. Promote remaining uses. (dead_debug_global_finish): New. (dead_debug_add): Try to replace global temps first. (dead_debug_insert_temp): Support global replacements. * dce.c (word_dce_process_block, dce_process_block): Add global_debug parameter. Pass it on. (fast_dce): Initialize, pass on and finalize global_debug. * df-problems.c (df_set_unused_notes_for_mw): Adjusted. (df_create_unused_notes, df_note_bb_compute): Likewise. (df_note_compute): Justify local-only dead debug analysis. gcc/testsuite/ChangeLog: PR debug/54551 * gcc.dg/guality/pr54551.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@192001 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/dce.c')
-rw-r--r--gcc/dce.c35
1 files changed, 23 insertions, 12 deletions
diff --git a/gcc/dce.c b/gcc/dce.c
index c951865f765..11f8edb7b70 100644
--- a/gcc/dce.c
+++ b/gcc/dce.c
@@ -806,15 +806,17 @@ struct rtl_opt_pass pass_ud_rtl_dce =
/* Process basic block BB. Return true if the live_in set has
changed. REDO_OUT is true if the info at the bottom of the block
needs to be recalculated before starting. AU is the proper set of
- artificial uses. */
+ artificial uses. Track global substitution of uses of dead pseudos
+ in debug insns using GLOBAL_DEBUG. */
static bool
-word_dce_process_block (basic_block bb, bool redo_out)
+word_dce_process_block (basic_block bb, bool redo_out,
+ struct dead_debug_global *global_debug)
{
bitmap local_live = BITMAP_ALLOC (&dce_tmp_bitmap_obstack);
rtx insn;
bool block_changed;
- struct dead_debug debug;
+ struct dead_debug_local debug;
if (redo_out)
{
@@ -836,7 +838,7 @@ word_dce_process_block (basic_block bb, bool redo_out)
}
bitmap_copy (local_live, DF_WORD_LR_OUT (bb));
- dead_debug_init (&debug, NULL);
+ dead_debug_local_init (&debug, NULL, global_debug);
FOR_BB_INSNS_REVERSE (bb, insn)
if (DEBUG_INSN_P (insn))
@@ -890,7 +892,7 @@ word_dce_process_block (basic_block bb, bool redo_out)
if (block_changed)
bitmap_copy (DF_WORD_LR_IN (bb), local_live);
- dead_debug_finish (&debug, NULL);
+ dead_debug_local_finish (&debug, NULL);
BITMAP_FREE (local_live);
return block_changed;
}
@@ -899,16 +901,18 @@ word_dce_process_block (basic_block bb, bool redo_out)
/* Process basic block BB. Return true if the live_in set has
changed. REDO_OUT is true if the info at the bottom of the block
needs to be recalculated before starting. AU is the proper set of
- artificial uses. */
+ artificial uses. Track global substitution of uses of dead pseudos
+ in debug insns using GLOBAL_DEBUG. */
static bool
-dce_process_block (basic_block bb, bool redo_out, bitmap au)
+dce_process_block (basic_block bb, bool redo_out, bitmap au,
+ struct dead_debug_global *global_debug)
{
bitmap local_live = BITMAP_ALLOC (&dce_tmp_bitmap_obstack);
rtx insn;
bool block_changed;
df_ref *def_rec;
- struct dead_debug debug;
+ struct dead_debug_local debug;
if (redo_out)
{
@@ -932,7 +936,7 @@ dce_process_block (basic_block bb, bool redo_out, bitmap au)
bitmap_copy (local_live, DF_LR_OUT (bb));
df_simulate_initialize_backwards (bb, local_live);
- dead_debug_init (&debug, NULL);
+ dead_debug_local_init (&debug, NULL, global_debug);
FOR_BB_INSNS_REVERSE (bb, insn)
if (DEBUG_INSN_P (insn))
@@ -977,7 +981,7 @@ dce_process_block (basic_block bb, bool redo_out, bitmap au)
DEBUG_TEMP_BEFORE_WITH_VALUE);
}
- dead_debug_finish (&debug, NULL);
+ dead_debug_local_finish (&debug, NULL);
df_simulate_finalize_backwards (bb, local_live);
block_changed = !bitmap_equal_p (local_live, DF_LR_IN (bb));
@@ -1014,12 +1018,15 @@ fast_dce (bool word_level)
bitmap au = &df->regular_block_artificial_uses;
bitmap au_eh = &df->eh_block_artificial_uses;
int i;
+ struct dead_debug_global global_debug;
prescan_insns_for_dce (true);
for (i = 0; i < n_blocks; i++)
bitmap_set_bit (all_blocks, postorder[i]);
+ dead_debug_global_init (&global_debug, NULL);
+
while (global_changed)
{
global_changed = false;
@@ -1038,11 +1045,13 @@ fast_dce (bool word_level)
if (word_level)
local_changed
- = word_dce_process_block (bb, bitmap_bit_p (redo_out, index));
+ = word_dce_process_block (bb, bitmap_bit_p (redo_out, index),
+ &global_debug);
else
local_changed
= dce_process_block (bb, bitmap_bit_p (redo_out, index),
- bb_has_eh_pred (bb) ? au_eh : au);
+ bb_has_eh_pred (bb) ? au_eh : au,
+ &global_debug);
bitmap_set_bit (processed, index);
if (local_changed)
@@ -1090,6 +1099,8 @@ fast_dce (bool word_level)
}
}
+ dead_debug_global_finish (&global_debug, NULL);
+
delete_unmarked_insns ();
BITMAP_FREE (processed);