On 12/02/2015 06:23 AM, Michael Matz wrote:
Hi,
On Tue, 1 Dec 2015, Jeff Law wrote:
So, okay for trunk?
-ENOPATCH
Sigh :)
Here it is.
Ciao,
Michael.
* common.opt (-fsplit-loops): New flag.
* passes.def (pass_loop_split): Add.
* opts.c (default_options_table): Add OPT_fsplit_loops entry at -O3.
(enable_fdo_optimizations): Add loop splitting.
* timevar.def (TV_LOOP_SPLIT): Add.
* tree-pass.h (make_pass_loop_split): Declare.
* tree-ssa-loop-manip.h (rewrite_into_loop_closed_ssa_1): Declare.
* tree-ssa-loop-unswitch.c: Include tree-ssa-loop-manip.h,
* tree-ssa-loop-split.c: New file.
* Makefile.in (OBJS): Add tree-ssa-loop-split.o.
* doc/invoke.texi (fsplit-loops): Document.
* doc/passes.texi (Loop optimization): Add paragraph about loop
splitting.
testsuite/
* gcc.dg/loop-split.c: New test.
Index: tree-ssa-loop-split.c
+/* Return true when BB inside LOOP is a potential iteration space
+ split point, i.e. ends with a condition like "IV < comp", which
+ is true on one side of the iteration space and false on the other,
+ and the split point can be computed. If so, also return the border
+ point in *BORDER and the comparison induction variable in IV. */
+
+static tree
+split_at_bb_p (struct loop *loop, basic_block bb, tree *border, affine_iv *iv)
+{
+ gimple *last;
+ gcond *stmt;
+ affine_iv iv2;
+
+
+ /* Make it so, that the first argument of the condition is
+ the looping one (only swap. */
Nit. I don't think you want a comma after "so". And it looks like your
comment got truncated as well.
With the comment above fixed, this is fine for the trunk.
jeff