+2020-05-12 Richard Biener <rguenther@suse.de>
+
+ * tree-ssa-live.c (remove_unused_locals): Remove dead debug
+ bind resets.
+
2020-05-12 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/msp430/msp430-protos.h (msp430_output_aligned_decl_common):
mark_scope_block_unused (DECL_INITIAL (current_function_decl));
usedvars = BITMAP_ALLOC (NULL);
+ auto_bitmap useddebug;
/* Walk the CFG marking all referenced symbols. */
FOR_EACH_BB_FN (bb, cfun)
do it. If the block is not otherwise used, the stmt will
be cleaned up in clean_unused_block_pointer. */
if (is_gimple_debug (stmt))
- continue;
+ {
+ if (gimple_debug_bind_p (stmt))
+ {
+ tree var = gimple_debug_bind_get_var (stmt);
+ if (VAR_P (var))
+ {
+ if (!gimple_debug_bind_get_value (stmt))
+ /* Run the 2nd phase. */
+ have_local_clobbers = true;
+ else
+ bitmap_set_bit (useddebug, DECL_UID (var));
+ }
+ }
+ continue;
+ }
if (gimple_clobber_p (stmt))
{
if (b)
TREE_USED (b) = true;
}
+ else if (gimple_debug_bind_p (stmt))
+ {
+ tree var = gimple_debug_bind_get_var (stmt);
+ if (VAR_P (var)
+ && !bitmap_bit_p (useddebug, DECL_UID (var))
+ && !is_used_p (var))
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ fprintf (dump_file, "Dead debug bind reset to %u\n",
+ DECL_UID (var));
+ gsi_remove (&gsi, true);
+ continue;
+ }
+ }
gsi_next (&gsi);
}
}