Lines Matching refs:loop

35 /* This pass moves constant conditions out of loops, duplicating the loop
50 where nothing inside the loop alters cond is transformed
75 Duplicating the loop might lead to code growth exponential in number of
76 branches inside loop, so we limit the number of unswitchings performed
77 in a single loop to PARAM_MAX_UNSWITCH_LEVEL. We only perform the
82 static struct loop *unswitch_loop (struct loops *, struct loop *,
84 static void unswitch_single_loop (struct loops *, struct loop *, rtx, int);
85 static rtx may_unswitch_on (basic_block, struct loop *, rtx *);
138 /* Main entry point. Perform loop unswitching on all suitable LOOPS. */
143 struct loop *loop;
150 /* Removed loop? */
151 loop = loops->parray[i];
152 if (!loop)
155 if (loop->inner)
158 unswitch_single_loop (loops, loop, NULL_RTX, 0);
170 compares loop invariant cc mode register, return the jump in CINSN. */
173 may_unswitch_on (basic_block bb, struct loop *loop, rtx *cinsn)
186 /* With branches inside loop. */
187 if (!flow_bb_inside_loop_p (loop, EDGE_SUCC (bb, 0)->dest)
188 || !flow_bb_inside_loop_p (loop, EDGE_SUCC (bb, 1)->dest))
192 are unable to update dominator/irreducible loop information correctly). */
193 if (!just_once_each_iteration_p (loop, bb))
262 unswitch_single_loop (struct loops *loops, struct loop *loop,
266 struct loop *nloop;
281 if (loop->inner)
284 fprintf (dump_file, ";; Not unswitching, not innermost loop\n");
288 /* We must be able to duplicate loop body. */
289 if (!can_duplicate_loop_p (loop))
292 fprintf (dump_file, ";; Not unswitching, can't duplicate loop\n");
296 /* The loop should not be too large, to limit code growth. */
297 if (num_loop_insns (loop) > PARAM_VALUE (PARAM_MAX_UNSWITCH_INSNS))
300 fprintf (dump_file, ";; Not unswitching, loop too big\n");
305 if (!maybe_hot_bb_p (loop->header))
312 /* Nor if the loop usually does not roll. */
313 if (expected_loop_iterations (loop) < 1)
316 fprintf (dump_file, ";; Not unswitching, loop iterations < 1\n");
326 bbs = get_loop_body (loop);
327 iv_analysis_loop_init (loop);
328 for (i = 0; i < loop->num_nodes; i++)
329 if ((cond = may_unswitch_on (bbs[i], loop, &cinsn)))
332 if (i == loop->num_nodes)
376 fprintf (dump_file, ";; Unswitching loop\n");
378 /* Unswitch the loop on this condition. */
379 nloop = unswitch_loop (loops, loop, bbs[i], cond, cinsn);
384 unswitch_single_loop (loops, loop, conds, num + 1);
396 determining which loop is entered. Returns NULL if impossible, new loop
397 otherwise. The new loop is entered if COND is true. If CINSN is not
400 static struct loop *
401 unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on,
406 struct loop *nloop;
412 gcc_assert (flow_bb_inside_loop_p (loop, unswitch_on));
414 gcc_assert (just_once_each_iteration_p (loop, unswitch_on));
415 gcc_assert (!loop->inner);
416 gcc_assert (flow_bb_inside_loop_p (loop, EDGE_SUCC (unswitch_on, 0)->dest));
417 gcc_assert (flow_bb_inside_loop_p (loop, EDGE_SUCC (unswitch_on, 1)->dest));
419 entry = loop_preheader_edge (loop);
426 if (!duplicate_loop_to_header_edge (loop, entry, loops, 1,
439 latch_edge = single_succ_edge (get_bb_copy (loop->latch));
468 /* Loopify from the copy of LOOP body, constructing the new loop. */
470 single_pred_edge (get_bb_copy (loop->header)), switch_bb,
477 /* One of created loops do not have to be subloop of the outer loop now,
478 so fix its placement in loop data structure. */
479 fix_loop_placement (loop);
482 /* Preserve the simple loop preheaders. */
483 loop_split_edge_with (loop_preheader_edge (loop), NULL_RTX);