Richard Biener wrote:
>
> The following fixes missing dominator computation before fixing loops.
> Rather than doing even more such weird stuff in a pass gate function
> this puts this into a new pass scheduled before the loop passes gate.
>
Ok.
> +unsigned int
> +pass_fix_loops::execute (function *)
> +{
I would add an early exit if there are no loops in the function
(like in the original code below...)
if (!loops_for_fn (fn))
return 0;
> + if (loops_state_satisfies_p (LOOPS_NEED_FIXUP))
> + {
> + calculate_dominance_info (CDI_DOMINATORS);
> + fix_loop_structure (NULL);
> + }
> + return 0;
> +}
[...]
> /* Gate for loop pass group. The group is controlled by -ftree-loop-optimize
> but we also avoid running it when the IL doesn't contain any loop. */
>
> @@ -57,9 +107,6 @@ gate_loop (function *fn)
> if (!loops_for_fn (fn))
> return true;
... here.
>
> - /* Make sure to drop / re-discover loops when necessary. */
> - if (loops_state_satisfies_p (LOOPS_NEED_FIXUP))
> - fix_loop_structure (NULL);
> return number_of_loops (fn) > 1;
> }