aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>2012-09-11 12:23:25 +0000
committerWilliam Schmidt <wschmidt@gcc.gnu.org>2012-09-11 12:23:25 +0000
commitccdbfe9398e4c225706599e6b291f4cf0e616df8 (patch)
tree3a554aee711b2212e5a769dd87e1616f33de6dbb /gcc
parentb8f4e58fbcd3fa19e8bdc65652e58b5c7f8d6f42 (diff)
downloadgcc-ccdbfe9398e4c225706599e6b291f4cf0e616df8.zip
gcc-ccdbfe9398e4c225706599e6b291f4cf0e616df8.tar.gz
gcc-ccdbfe9398e4c225706599e6b291f4cf0e616df8.tar.bz2
re PR middle-end/55492 (__atomic_load doesn't match ACQUIRE memory model)
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. From-SVN: r191178
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog8
-rw-r--r--gcc/doc/invoke.texi5
-rw-r--r--gcc/gimple-ssa-strength-reduction.c7
-rw-r--r--gcc/params.def7
4 files changed, 26 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 77f65bd..c4b237c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+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.
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 994e4db..1a854b0 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -9407,6 +9407,11 @@ having a regular register file and accurate register pressure classes.
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
diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c
index 0e770a9..87684b3 100644
--- a/gcc/gimple-ssa-strength-reduction.c
+++ b/gcc/gimple-ssa-strength-reduction.c
@@ -54,6 +54,7 @@ along with GCC; see the file COPYING3. If not see
#include "domwalk.h"
#include "pointer-set.h"
#include "expmed.h"
+#include "params.h"
/* Information about a strength reduction candidate. Each statement
in the candidate table represents an expression of one of the
@@ -353,10 +354,14 @@ find_basis_for_candidate (slsr_cand_t c)
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;
diff --git a/gcc/params.def b/gcc/params.def
index c7f27fe..a4c930b 100644
--- a/gcc/params.def
+++ b/gcc/params.def
@@ -979,6 +979,13 @@ DEFPARAM (PARAM_SCHED_PRESSURE_ALGORITHM,
"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