Lines Matching refs:loop
77 static class loop *tree_unswitch_loop (class loop *, basic_block, tree);
78 static bool tree_unswitch_single_loop (class loop *, int);
79 static tree tree_may_unswitch_on (basic_block, class loop *);
80 static bool tree_unswitch_outer_loop (class loop *);
81 static edge find_loop_guard (class loop *);
82 static bool empty_bb_without_guard_p (class loop *, basic_block);
83 static bool used_outside_loop_p (class loop *, tree);
84 static void hoist_guard (class loop *, edge);
85 static bool check_exit_phi (class loop *);
86 static tree get_vop_from_header (class loop *);
93 class loop *loop; in tree_ssa_unswitch_loops() local
97 FOR_EACH_LOOP (loop, LI_FROM_INNERMOST) in tree_ssa_unswitch_loops()
99 if (!loop->inner) in tree_ssa_unswitch_loops()
101 changed |= tree_unswitch_single_loop (loop, 0); in tree_ssa_unswitch_loops()
103 changed |= tree_unswitch_outer_loop (loop); in tree_ssa_unswitch_loops()
116 is_maybe_undefined (const tree name, gimple *stmt, class loop *loop) in is_maybe_undefined() argument
121 if (gimple_bb (stmt) == loop->header) in is_maybe_undefined()
159 if (dominated_by_p (CDI_DOMINATORS, loop->header, gimple_bb (def))) in is_maybe_undefined()
189 tree_may_unswitch_on (basic_block bb, class loop *loop) in tree_may_unswitch_on() argument
215 && flow_bb_inside_loop_p (loop, def_bb)) in tree_may_unswitch_on()
219 if (is_maybe_undefined (use, stmt, loop)) in tree_may_unswitch_on()
234 simplify_using_entry_checks (class loop *loop, tree cond) in simplify_using_entry_checks() argument
236 edge e = loop_preheader_edge (loop); in simplify_using_entry_checks()
267 tree_unswitch_single_loop (class loop *loop, int num) in tree_unswitch_single_loop() argument
270 class loop *nloop; in tree_unswitch_single_loop()
281 if (optimize_loop_for_size_p (loop)) in tree_unswitch_single_loop()
289 if (tree_num_loop_insns (loop, &eni_size_weights) in tree_unswitch_single_loop()
299 iterations = estimated_loop_iterations_int (loop); in tree_unswitch_single_loop()
301 iterations = likely_max_loop_iterations_int (loop); in tree_unswitch_single_loop()
312 bbs = get_loop_body (loop); in tree_unswitch_single_loop()
313 found = loop->num_nodes; in tree_unswitch_single_loop()
318 for (; i < loop->num_nodes; i++) in tree_unswitch_single_loop()
319 if ((cond = tree_may_unswitch_on (bbs[i], loop))) in tree_unswitch_single_loop()
322 if (i == loop->num_nodes) in tree_unswitch_single_loop()
329 if (found == loop->num_nodes) in tree_unswitch_single_loop()
337 cond = simplify_using_entry_checks (loop, cond); in tree_unswitch_single_loop()
364 if (found == loop->num_nodes) in tree_unswitch_single_loop()
386 tos = worklist = XNEWVEC (basic_block, loop->num_nodes); in tree_unswitch_single_loop()
388 for (i = 0; i < loop->num_nodes; i++) in tree_unswitch_single_loop()
424 if (dest->loop_father == loop in tree_unswitch_single_loop()
437 for (; found < loop->num_nodes; found++) in tree_unswitch_single_loop()
439 && (cond = tree_may_unswitch_on (bbs[found], loop))) in tree_unswitch_single_loop()
442 if (found == loop->num_nodes) in tree_unswitch_single_loop()
454 nloop = tree_unswitch_loop (loop, bbs[found], cond); in tree_unswitch_single_loop()
468 tree_unswitch_single_loop (loop, num + 1); in tree_unswitch_single_loop()
478 static class loop *
479 tree_unswitch_loop (class loop *loop, in tree_unswitch_loop() argument
486 gcc_assert (flow_bb_inside_loop_p (loop, unswitch_on)); in tree_unswitch_loop()
488 gcc_assert (loop->inner == NULL); in tree_unswitch_loop()
492 return loop_version (loop, unshare_expr (cond), in tree_unswitch_loop()
502 tree_unswitch_outer_loop (class loop *loop) in tree_unswitch_outer_loop() argument
507 gcc_assert (loop->inner); in tree_unswitch_outer_loop()
508 if (loop->inner->next) in tree_unswitch_outer_loop()
511 exit = single_exit (loop); in tree_unswitch_outer_loop()
512 if (!exit || exit->src->loop_father != loop) in tree_unswitch_outer_loop()
515 if (!check_exit_phi (loop)) in tree_unswitch_outer_loop()
519 iterations = estimated_loop_iterations_int (loop); in tree_unswitch_outer_loop()
521 iterations = likely_max_loop_iterations_int (loop); in tree_unswitch_outer_loop()
531 while ((guard = find_loop_guard (loop))) in tree_unswitch_outer_loop()
534 rewrite_virtuals_into_loop_closed_ssa (loop); in tree_unswitch_outer_loop()
535 hoist_guard (loop, guard); in tree_unswitch_outer_loop()
546 find_loop_guard (class loop *loop) in find_loop_guard() argument
548 basic_block header = loop->header; in find_loop_guard()
608 if (!flow_bb_inside_loop_p (loop, te->dest) in find_loop_guard()
609 || !flow_bb_inside_loop_p (loop, fe->dest)) in find_loop_guard()
612 if (just_once_each_iteration_p (loop, te->dest) in find_loop_guard()
614 && just_once_each_iteration_p (loop, single_succ (te->dest)))) in find_loop_guard()
616 if (just_once_each_iteration_p (loop, fe->dest)) in find_loop_guard()
620 else if (just_once_each_iteration_p (loop, fe->dest) in find_loop_guard()
622 && just_once_each_iteration_p (loop, single_succ (fe->dest)))) in find_loop_guard()
628 if (!dominated_by_p (CDI_DOMINATORS, loop->inner->header, in find_loop_guard()
636 if (guard_edge->dest == loop->latch) in find_loop_guard()
646 guard_edge->src->index, guard_edge->dest->index, loop->num); in find_loop_guard()
654 && flow_bb_inside_loop_p (loop, def_bb)) in find_loop_guard()
663 body = get_loop_body (loop); in find_loop_guard()
664 for (i = 0; i < loop->num_nodes; i++) in find_loop_guard()
667 if (bb->loop_father != loop) in find_loop_guard()
677 if (!empty_bb_without_guard_p (loop, bb)) in find_loop_guard()
703 empty_bb_without_guard_p (class loop *loop, basic_block bb) in empty_bb_without_guard_p() argument
705 basic_block exit_bb = single_exit (loop)->src; in empty_bb_without_guard_p()
723 if (used_outside_loop_p (loop, name)) in empty_bb_without_guard_p()
741 && used_outside_loop_p (loop, name)) in empty_bb_without_guard_p()
751 used_outside_loop_p (class loop *loop, tree name) in used_outside_loop_p() argument
759 if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt))) in used_outside_loop_p()
769 get_vop_from_header (class loop *loop) in get_vop_from_header() argument
771 for (gphi_iterator gsi = gsi_start_phis (loop->header); in get_vop_from_header()
777 return PHI_ARG_DEF_FROM_EDGE (phi, loop_preheader_edge (loop)); in get_vop_from_header()
785 hoist_guard (class loop *loop, edge guard) in hoist_guard() argument
787 edge exit = single_exit (loop); in hoist_guard()
788 edge preh = loop_preheader_edge (loop); in hoist_guard()
801 fix_dom_of_exit = flow_bb_inside_loop_p (loop, bb); in hoist_guard()
835 gcc_assert (loop_preheader_edge (loop)->src == e->dest); in hoist_guard()
885 basic_block *body = get_loop_body (loop); in hoist_guard()
889 for (unsigned int i = 0; i < loop->num_nodes; i++) in hoist_guard()
912 arg = get_vop_from_header (loop); in hoist_guard()
936 check_exit_phi (class loop *loop) in check_exit_phi() argument
938 edge exit = single_exit (loop); in check_exit_phi()
939 basic_block pre_header = loop_preheader_edge (loop)->src; in check_exit_phi()