Commit 568876dc by Jan Hubicka Committed by Jan Hubicka

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
parent b2ae2814
2016-06-07 Jan Hubicka <hubicka@ucw.cz>
* 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.
2016-06-08 Richard Biener <rguenther@suse.de> 2016-06-08 Richard Biener <rguenther@suse.de>
* tree-vect-stmts.c (vectorizable_load): Remove restrictions * tree-vect-stmts.c (vectorizable_load): Remove restrictions
......
...@@ -9066,6 +9066,10 @@ The maximum number of insns of an unswitched loop. ...@@ -9066,6 +9066,10 @@ The maximum number of insns of an unswitched loop.
@item max-unswitch-level @item max-unswitch-level
The maximum number of branches unswitched in a single loop. The maximum number of branches unswitched in a single loop.
@item max-loop-headers-insns
The maximum number of insns in loop header duplicated by he copy loop headers
pass.
@item lim-expensive @item lim-expensive
The minimum cost of an expensive expression in the loop invariant motion. The minimum cost of an expensive expression in the loop invariant motion.
......
...@@ -344,6 +344,13 @@ DEFPARAM(PARAM_MAX_UNSWITCH_LEVEL, ...@@ -344,6 +344,13 @@ DEFPARAM(PARAM_MAX_UNSWITCH_LEVEL,
"The maximum number of unswitchings in a single loop.", "The maximum number of unswitchings in a single loop.",
3, 0, 0) 3, 0, 0)
/* The maximum number of insns in loop header duplicated by he copy loop
headers pass. */
DEFPARAM(PARAM_MAX_LOOP_HEADER_INSNS,
"max-loop-header-insns",
"The maximum number of insns in loop header duplicated by he copy loop headers pass.",
20, 0, 0)
/* The maximum number of iterations of a loop the brute force algorithm /* The maximum number of iterations of a loop the brute force algorithm
for analysis of # of iterations of the loop tries to evaluate. */ for analysis of # of iterations of the loop tries to evaluate. */
DEFPARAM(PARAM_MAX_ITERATIONS_TO_TRACK, DEFPARAM(PARAM_MAX_ITERATIONS_TO_TRACK,
......
...@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see ...@@ -33,6 +33,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-inline.h" #include "tree-inline.h"
#include "tree-ssa-scopedtables.h" #include "tree-ssa-scopedtables.h"
#include "tree-ssa-threadedge.h" #include "tree-ssa-threadedge.h"
#include "params.h"
/* Duplicates headers of loops if they are small enough, so that the statements /* 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 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, ...@@ -106,8 +107,7 @@ should_duplicate_loop_header_p (basic_block header, struct loop *loop,
return false; return false;
} }
/* Approximately copy the conditions that used to be used in jump.c -- /* Count number of instructions and punt on calls. */
at most 20 insns and no calls. */
for (bsi = gsi_start_bb (header); !gsi_end_p (bsi); gsi_next (&bsi)) for (bsi = gsi_start_bb (header); !gsi_end_p (bsi); gsi_next (&bsi))
{ {
last = gsi_stmt (bsi); last = gsi_stmt (bsi);
...@@ -290,8 +290,8 @@ ch_base::copy_headers (function *fun) ...@@ -290,8 +290,8 @@ ch_base::copy_headers (function *fun)
FOR_EACH_LOOP (loop, 0) FOR_EACH_LOOP (loop, 0)
{ {
/* Copy at most 20 insns. */ int initial_limit = PARAM_VALUE (PARAM_MAX_LOOP_HEADER_INSNS);
int limit = 20; int remaining_limit = initial_limit;
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, fprintf (dump_file,
"Analyzing loop %i\n", loop->num); "Analyzing loop %i\n", loop->num);
...@@ -313,7 +313,7 @@ ch_base::copy_headers (function *fun) ...@@ -313,7 +313,7 @@ ch_base::copy_headers (function *fun)
exit = NULL; exit = NULL;
n_bbs = 0; 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 /* Find a successor of header that is inside a loop; i.e. the new
header after the condition is copied. */ header after the condition is copied. */
...@@ -333,7 +333,8 @@ ch_base::copy_headers (function *fun) ...@@ -333,7 +333,8 @@ ch_base::copy_headers (function *fun)
fprintf (dump_file, fprintf (dump_file,
"Duplicating header of the loop %d up to edge %d->%d," "Duplicating header of the loop %d up to edge %d->%d,"
" %i insns.\n", " %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 /* Ensure that the header will have just the latch as a predecessor
inside the loop. */ inside the loop. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment