Lines Matching refs:loop

53 #include "tree-ssa-loop-niter.h"
54 #include "tree-ssa-loop.h"
61 /* This file implements the loop unswitching, i.e. transformation of loops like
74 where inv is the loop invariant, into
94 tree-ssa-loop-im.c ensures that all the suitable conditions are in this
97 static struct loop *tree_unswitch_loop (struct loop *, basic_block, tree);
98 static bool tree_unswitch_single_loop (struct loop *, int);
99 static tree tree_may_unswitch_on (basic_block, struct loop *);
101 /* Main entry point. Perform loop unswitching on all suitable loops. */
106 struct loop *loop;
111 FOR_EACH_LOOP (loop, LI_ONLY_INNERMOST)
114 fprintf (dump_file, ";; Considering loop %d\n", loop->num);
117 if (optimize_loop_for_size_p (loop))
124 /* The loop should not be too large, to limit code growth. */
125 if (tree_num_loop_insns (loop, &eni_size_weights)
129 fprintf (dump_file, ";; Not unswitching, loop too big\n");
133 /* If the loop is not expected to iterate, there is no need
135 iterations = estimated_loop_iterations_int (loop);
139 fprintf (dump_file, ";; Not unswitching, loop is not expected to iterate\n");
143 changed |= tree_unswitch_single_loop (loop, 0);
155 tree_may_unswitch_on (basic_block bb, struct loop *loop)
171 loop where we would unswitch again on such a condition. */
181 && flow_bb_inside_loop_p (loop, def_bb))
192 simplish (sufficient to prevent us from duplicating loop in unswitching
196 simplify_using_entry_checks (struct loop *loop, tree cond)
198 edge e = loop_preheader_edge (loop);
229 tree_unswitch_single_loop (struct loop *loop, int num)
232 struct loop *nloop;
239 bbs = get_loop_body (loop);
240 found = loop->num_nodes;
245 for (; i < loop->num_nodes; i++)
246 if ((cond = tree_may_unswitch_on (bbs[i], loop)))
249 if (i == loop->num_nodes)
256 if (found == loop->num_nodes)
264 cond = simplify_using_entry_checks (loop, cond);
288 loop and find the condition only among those still reachable bbs. */
291 if (found == loop->num_nodes)
313 tos = worklist = XNEWVEC (basic_block, loop->num_nodes);
315 for (i = 0; i < loop->num_nodes; i++)
323 within the same innermost loop. Don't look through false edges
351 if (dest->loop_father == loop
364 for (; found < loop->num_nodes; found++)
366 && (cond = tree_may_unswitch_on (bbs[found], loop)))
369 if (found == loop->num_nodes)
377 fprintf (dump_file, ";; Unswitching loop\n");
380 /* Unswitch the loop on this condition. */
381 nloop = tree_unswitch_loop (loop, bbs[found], cond);
395 tree_unswitch_single_loop (loop, num + 1);
402 loop is entered -- the new loop is entered if COND is true. Returns NULL
403 if impossible, new loop otherwise. */
405 static struct loop *
406 tree_unswitch_loop (struct loop *loop,
413 gcc_assert (flow_bb_inside_loop_p (loop, unswitch_on));
415 gcc_assert (loop->inner == NULL);
419 return loop_version (loop, unshare_expr (cond),