This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH, tree-optimization] Fix for PR 52868
On Wed, Apr 25, 2012 at 10:56 AM, Igor Zamyatin <firstname.lastname@example.org> wrote:
> Hi all!
> I'd like to post for review the patch which makes some costs adjusting
> in get_computation_cost_at routine in ivopts part.
> As mentioned in the PR changes also fix the bwaves regression from PR 52272.
> Also changes introduce no degradations on spec2000/2006 and
> EEMBC1.1/2.0(this was measured on Atom) on x86
> Bootstrapped and regtested on x86. Ok to commit?
I can't make sense of the patch and the comment does not help.
+ diff_cost = cost.cost;
cost.cost /= avg_loop_niter (data->current_loop);
+ add_cost_val = add_cost (TYPE_MODE (ctype), data->speed);
+ /* Do cost correction if address cost is small enough
+ and difference cost is high enough. */
+ if (address_p && diff_cost > add_cost_val
+ && get_address_cost (symbol_present, var_present,
+ offset, ratio, cstepi,
+ TYPE_MODE (TREE_TYPE (utype)),
+ TYPE_ADDR_SPACE (TREE_TYPE (utype)),
+ speed, stmt_is_after_inc,
+ can_autoinc).cost <= add_cost_val)
+ cost.cost += add_cost_val;
Please explain more thoroughly. It also would seem to be better to add
an extra case, as later code does
/* Now the computation is in shape symbol + var1 + const + ratio * var2.
(symbol/var1/const parts may be omitted). If we are looking for an
address, find the cost of addressing this. */
return add_costs (cost,
get_address_cost (symbol_present, var_present,
offset, ratio, cstepi,
TYPE_MODE (TREE_TYPE (utype)),
TYPE_ADDR_SPACE (TREE_TYPE (utype)),
thus refactoring the code a bit would make it possible to CSE the
call and eventually make it clearer what the code does.
> 2012-04-26 ?Yuri Rumyantsev ?<email@example.com>
> ? ? ? ?* tree-ssa-loop-ivopts.c (get_computation_cost_at): Add cost
> ? ? ? ?of extra addition if cost of address difference is high enough.