2011-03-17 Jakub Jelinek <jakub@redhat.com>
+ PR rtl-optimization/48141
+ * params.def (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES): New.
+ * dse.c: Include params.h.
+ (active_local_stores_len): New variable.
+ (add_wild_read, dse_step1): Clear it when setting active_local_stores
+ to NULL.
+ (record_store, check_mem_read_rtx): Decrease it when removing
+ from the chain.
+ (scan_insn): Likewise. Increase it when adding to chain, if it
+ reaches PARAM_MAX_DSE_ACTIVE_LOCAL_STORES limit, set to 1 and
+ set active_local_stores to NULL before the addition.
+ * Makefile.in (dse.o): Depend on $(PARAMS_H).
+
PR rtl-optimization/48141
* dse.c (record_store): If no positions are needed in an insn
that cannot be deleted, at least unchain it from active_local_stores.
#include "optabs.h"
#include "dbgcnt.h"
#include "target.h"
+#include "params.h"
/* This file contains three techniques for performing Dead Store
Elimination (dse).
/* The linked list of stores that are under consideration in this
basic block. */
static insn_info_t active_local_stores;
+static int active_local_stores_len;
struct bb_info
{
}
insn_info->wild_read = true;
active_local_stores = NULL;
+ active_local_stores_len = 0;
}
{
insn_info_t insn_to_delete = ptr;
+ active_local_stores_len--;
if (last)
last->next_local_store = ptr->next_local_store;
else
if (dump_file)
dump_insn_info ("removing from active", i_ptr);
+ active_local_stores_len--;
if (last)
last->next_local_store = i_ptr->next_local_store;
else
if (dump_file)
dump_insn_info ("removing from active", i_ptr);
+ active_local_stores_len--;
if (last)
last->next_local_store = i_ptr->next_local_store;
else
if (dump_file)
dump_insn_info ("removing from active", i_ptr);
+ active_local_stores_len--;
if (last)
last->next_local_store = i_ptr->next_local_store;
else
if (dump_file)
dump_insn_info ("removing from active", i_ptr);
+ active_local_stores_len--;
if (last)
last->next_local_store = i_ptr->next_local_store;
else
fprintf (dump_file, "handling memset as BLKmode store\n");
if (mems_found == 1)
{
+ if (active_local_stores_len++
+ >= PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES))
+ {
+ active_local_stores_len = 1;
+ active_local_stores = NULL;
+ }
insn_info->next_local_store = active_local_stores;
active_local_stores = insn_info;
}
it as cannot delete. This simplifies the processing later. */
if (mems_found == 1)
{
+ if (active_local_stores_len++
+ >= PARAM_VALUE (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES))
+ {
+ active_local_stores_len = 1;
+ active_local_stores = NULL;
+ }
insn_info->next_local_store = active_local_stores;
active_local_stores = insn_info;
}
if (del)
{
+ active_local_stores_len--;
if (last)
last->next_local_store = insn_info->next_local_store;
else
= create_alloc_pool ("cse_store_info_pool",
sizeof (struct store_info), 100);
active_local_stores = NULL;
+ active_local_stores_len = 0;
cselib_clear_table ();
/* Scan the insns. */
"The maximum number of instructions ready to be issued to be considered by the scheduler during the first scheduling pass",
100, 0, 0)
+/* This is the maximum number of active local stores RTL DSE will consider. */
+DEFPARAM (PARAM_MAX_DSE_ACTIVE_LOCAL_STORES,
+ "max-dse-active-local-stores",
+ "Maximum number of active local stores in RTL dead store elimination",
+ 5000, 0, 0)
+
/* Prefetching and cache-optimizations related parameters. Default values are
usually set by machine description. */