{
unsigned i;
bitmap depends_on;
- bool can_autoinc, first = true;
+ bool can_autoinc;
iv_inv_expr_ent *inv_expr = NULL;
struct iv_use *use = group->vuses[0];
comp_cost sum_cost = no_cost, cost;
{
struct iv_use *next = group->vuses[i];
- /* Compute cost for the first use with different offset to the main
- use and add it afterwards. Costs for these uses could be quite
- different. Given below uses in a group:
- use 0 : {base + A + offset_0, step}
- use 0.1: {base + A + offset_0, step}
- use 0.2: {base + A + offset_1, step}
- use 0.3: {base + A + offset_2, step}
- when we need to compute costs with candidate:
- cand 1 : {base + B + offset_0, step}
-
- The first use with different offset is use 0.2, its cost is larger
- than cost of use 0/0.1 because we need to compute:
- A - B + offset_1 - offset_0
- rather than:
- A - B. */
- if (first && next->addr_offset != use->addr_offset)
- {
- first = false;
- cost = get_computation_cost (data, next, cand, true,
- NULL, &can_autoinc, NULL);
- /* Remove setup cost. */
- if (!cost.infinite_cost_p ())
- cost -= cost.scratch;
- }
+ /* TODO: We could skip computing cost for sub iv_use when it has the
+ same cost as the first iv_use, but the cost really depends on the
+ offset and where the iv_use is. */
+ cost = get_computation_cost (data, next, cand, true,
+ NULL, &can_autoinc, NULL);
sum_cost += cost;
}
set_group_iv_cost (data, group, cand, sum_cost, depends_on,