This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [4.5] Doloop improvement patches, 7/7
Hi,
> >> This adds another way for simplify_using_initial_values to simplify an
> >> expression. If there's only on def for a given reg in the function, and
> >> it sets the register to a constant, we can simply replace that register
> >> in our expression.
> >
> > why does not constant propagation take care of this? I am somewhat
> > reluctant about letting this change in, if it merely masks a deficiency
> > in another optimization,
>
> To be honest, I didn't consider it, but I think that if a constant is
> used multiple times, it's expected that it won't be propagated -
> otherwise we'd just be undoing the effects of CSE. Even if the constant
> is used only once, it may have been moved out of a loop (an outer loop
> in the case we're looking at here), so I think there is no missed
> optimization elsewhere.
right, I keep forgetting about architectures that do not permit
constants as operands. The patch is OK.
> + for (;;)
> + if (for_each_rtx (expr, replace_single_def_regs, expr) == 0)
> + break;
while (for_each_rtx (expr, replace_single_def_regs, expr) != 0)
continue;
might be easier to understand.
Zdenek