re PR middle-end/55492 (__atomic_load doesn't match ACQUIRE memory model)
authorBill Schmidt <wschmidt@linux.vnet.ibm.com>
Tue, 11 Sep 2012 12:23:25 +0000 (12:23 +0000)
committerWilliam Schmidt <wschmidt@gcc.gnu.org>
Tue, 11 Sep 2012 12:23:25 +0000 (12:23 +0000)
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

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/gimple-ssa-strength-reduction.c
gcc/params.def

index 77f65bd62c18606058291d462d452ba60df1df79..c4b237c284b1f7cffe64bbb1b48f798e68d90c19 100644 (file)
@@ -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.
index 994e4db5fbfb0b1eb199702ad10c7ed56ee2891d..1a854b06a6766eb82198b733f3ac9274aa01654e 100644 (file)
@@ -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
 
index 0e770a949bf4826cd025cf5716389a75f96c2204..87684b3054362c3bceb050478d01cd8bfff81f9c 100644 (file)
@@ -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"
 \f
 /* 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;
 
index c7f27fe9d99670a2ea0211dca0f7434577ef136b..a4c930b9e3cc4abd293e76230c8e58c24088645f 100644 (file)
@@ -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