summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ch.c
diff options
context:
space:
mode:
authorJan Hubicka <hubicka@ucw.cz>2016-06-08 16:11:51 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2016-06-08 14:11:51 +0000
commit568876dc709a2ee474d321c0f36eb81684cc5b9b (patch)
tree91aebe6452474922006a1d37af8afb3dfbac16d0 /gcc/tree-ssa-loop-ch.c
parentb2ae281460cad49e85ba533aef075685ed5430ea (diff)
invoke.texi (max-loop-headers-insns): Document.
* invoke.texi (max-loop-headers-insns): Document. * params.def (PARAM_MAX_LOOP_HEADER_INSNS): New. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Update comment. (ch_base::copy_headers): Use PARAM_MAX_LOOP_HEADER_INSNS. From-SVN: r237219
Diffstat (limited to 'gcc/tree-ssa-loop-ch.c')
-rw-r--r--gcc/tree-ssa-loop-ch.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/gcc/tree-ssa-loop-ch.c b/gcc/tree-ssa-loop-ch.c
index 0ddbda6da7e..9a8136968de 100644
--- a/gcc/tree-ssa-loop-ch.c
+++ b/gcc/tree-ssa-loop-ch.c
@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h"
#include "tree-ssa-scopedtables.h"
#include "tree-ssa-threadedge.h"
+#include "params.h"
/* Duplicates headers of loops if they are small enough, so that the statements
in the loop body are always executed when the loop is entered. This
@@ -106,8 +107,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop,
return false;
}
- /* Approximately copy the conditions that used to be used in jump.c --
- at most 20 insns and no calls. */
+ /* Count number of instructions and punt on calls. */
for (bsi = gsi_start_bb (header); !gsi_end_p (bsi); gsi_next (&bsi))
{
last = gsi_stmt (bsi);
@@ -290,8 +290,8 @@ ch_base::copy_headers (function *fun)
FOR_EACH_LOOP (loop, 0)
{
- /* Copy at most 20 insns. */
- int limit = 20;
+ int initial_limit = PARAM_VALUE (PARAM_MAX_LOOP_HEADER_INSNS);
+ int remaining_limit = initial_limit;
if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file,
"Analyzing loop %i\n", loop->num);
@@ -313,7 +313,7 @@ ch_base::copy_headers (function *fun)
exit = NULL;
n_bbs = 0;
- while (should_duplicate_loop_header_p (header, loop, &limit))
+ while (should_duplicate_loop_header_p (header, loop, &remaining_limit))
{
/* Find a successor of header that is inside a loop; i.e. the new
header after the condition is copied. */
@@ -333,7 +333,8 @@ ch_base::copy_headers (function *fun)
fprintf (dump_file,
"Duplicating header of the loop %d up to edge %d->%d,"
" %i insns.\n",
- loop->num, exit->src->index, exit->dest->index, 20 - limit);
+ loop->num, exit->src->index, exit->dest->index,
+ initial_limit - remaining_limit);
/* Ensure that the header will have just the latch as a predecessor
inside the loop. */