+2012-09-11 Bill Schmidt <wschmidt@linux.vnet.ibm.com>
+
+ PR tree-optimization/55492
+ * doc/invoke.texi (max-slsr-cand-scan): New description.
+ * gimple-ssa-strength-reduction.c (find_basis_for_candidate): Limit
+ the time spent searching for a basis.
+ * params.def (PARAM_MAX_SLSR_CANDIDATE_SCAN): New param.
+
2012-09-11 Richard Guenther <rguenther@suse.de>
* gimple.h (gimple_register_type): Remove.
See @file{haifa-sched.c} in the GCC sources for more details.
The default choice depends on the target.
+
+@item max-slsr-cand-scan
+Set the maximum number of existing candidates that will be considered when
+seeking a basis for a new straight-line strength reduction candidate.
+
@end table
@end table
#include "domwalk.h"
#include "pointer-set.h"
#include "expmed.h"
+#include "params.h"
\f
/* Information about a strength reduction candidate. Each statement
in the candidate table represents an expression of one of the
cand_chain_t chain;
slsr_cand_t basis = NULL;
+ // Limit potential of N^2 behavior for long candidate chains.
+ int iters = 0;
+ int max_iters = PARAM_VALUE (PARAM_MAX_SLSR_CANDIDATE_SCAN);
+
mapping_key.base_expr = c->base_expr;
chain = (cand_chain_t) htab_find (base_cand_map, &mapping_key);
- for (; chain; chain = chain->next)
+ for (; chain && iters < max_iters; chain = chain->next, ++iters)
{
slsr_cand_t one_basis = chain->cand;
"Which -fsched-pressure algorithm to apply",
1, 1, 2)
+/* Maximum length of candidate scans in straight-line strength reduction. */
+DEFPARAM (PARAM_MAX_SLSR_CANDIDATE_SCAN,
+ "max-slsr-cand-scan",
+ "Maximum length of candidate scans for straight-line "
+ "strength reduction",
+ 50, 1, 999999)
+
/*
Local variables:
mode:c