This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH GCC]Compute, cache and use cost of auto-increment rtx patterns in IVOPT

On Mon, Nov 4, 2013 at 4:31 AM, bin.cheng <> wrote:
> Hi,
> The IVOPT in GCC has a problem that it does not use cost of auto-increment
> address expression in accounting, while it retreats to cost of address
> expression if auto-increment addressing mode is unavailable.
> For example, on ARM target:
> 1) the cost of "[reg]" (which is 6) is used for address expression "[reg],
> #off";
> 2) the cost of "[reg+off]" (which is 2) is used for address expression
> "[reg, #off]!";
> This causes:
> 1) cost of non-auto increment address expression is used for auto-increment
> address expression;
> 2) different address costs are used for pre/post increment address
> expressions.
> This patch fixes the problem by computing, caching and using the cost of
> auto-increment address expressions.
> Bootstrap and test on x86/arm.  Is it OK?

But don't you need to adjust

static bool
determine_use_iv_cost_address (struct ivopts_data *data,
                               struct iv_use *use, struct iv_cand *cand)
  bitmap depends_on;
  bool can_autoinc;
  int inv_expr_id = -1;
  comp_cost cost = get_computation_cost (data, use, cand, true, &depends_on,
                                         &can_autoinc, &inv_expr_id);

  if (cand->ainc_use == use)
      if (can_autoinc)
        cost.cost -= cand->cost_step;

this which seems to try to compensate for your issue?

Or maybe I don't understand.

CCing Bernd who implemented this IIRC.


> 2013-11-01  Bin Cheng  <>
>         * tree-ssa-loop-ivopts.c (enum ainc_type): New.
>         (address_cost_data): New field.
>         (get_address_cost): Compute auto-increment rtx cost in ainc_costs.
>         Use ainc_costs for auto-increment rtx patterns.
>         Cleanup TWS.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]