void
tree_ssa_unswitch_loops (struct loops *loops)
{
  int i, num;
  struct loop *loop;
  bool changed = false;

  /* Go through inner loops (only original ones).  */
  num = loops->num;

  for (i = 1; i < num; i++)
    {
      /* Removed loop?  */
      loop = loops->parray[i];
      if (!loop)
	continue;

      if (loop->inner)
	continue;

      changed |= tree_unswitch_single_loop (loops, loop, 0);
    }

  if (changed)
    cleanup_tree_cfg_loop ();
}
unsigned int
tree_ssa_unswitch_loops (void)
{
  loop_iterator li;
  struct loop *loop;
  bool changed = false;

  /* Go through inner loops (only original ones).  */
  FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
    {
      changed |= tree_unswitch_single_loop (loop, 0);
    }
Пример #3
0
unsigned int
tree_ssa_unswitch_loops (void)
{
    loop_iterator li;
    struct loop *loop;
    bool changed = false;
    HOST_WIDE_INT iterations;

    /* Go through inner loops (only original ones).  */
    FOR_EACH_LOOP (li, loop, LI_ONLY_INNERMOST)
    {
        if (dump_file && (dump_flags & TDF_DETAILS))
            fprintf (dump_file, ";; Considering loop %d\n", loop->num);

        /* Do not unswitch in cold regions. */
        if (optimize_loop_for_size_p (loop))
        {
            if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, ";; Not unswitching cold loops\n");
            continue;
        }

        /* The loop should not be too large, to limit code growth. */
        if (tree_num_loop_insns (loop, &eni_size_weights)
                > (unsigned) PARAM_VALUE (PARAM_MAX_UNSWITCH_INSNS))
        {
            if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, ";; Not unswitching, loop too big\n");
            continue;
        }

        /* If the loop is not expected to iterate, there is no need
        for unswitching.  */
        iterations = estimated_loop_iterations_int (loop);
        if (iterations >= 0 && iterations <= 1)
        {
            if (dump_file && (dump_flags & TDF_DETAILS))
                fprintf (dump_file, ";; Not unswitching, loop is not expected to iterate\n");
            continue;
        }

        changed |= tree_unswitch_single_loop (loop, 0);
    }

    if (changed)
        return TODO_cleanup_cfg;
    return 0;
}
Пример #4
0
unsigned int
tree_ssa_unswitch_loops (void)
{
    struct loop *loop;
    bool changed = false;

    /* Go through all loops starting from innermost.  */
    FOR_EACH_LOOP (loop, LI_FROM_INNERMOST)
    {
        if (!loop->inner)
            /* Unswitch innermost loop.  */
            changed |= tree_unswitch_single_loop (loop, 0);
        else
            changed |= tree_unswitch_outer_loop (loop);
    }

    if (changed)
        return TODO_cleanup_cfg;
    return 0;
}