[PATCH] D27321: Fix LSR ImmCost calculation for profitable chains

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 11:20:10 PST 2017


evstupac added a comment.

> Second access of %arg1 is through PrevArg1Access + 1 <-- this is supposed to be free by the chain profitability model

It is free in terms of RegNum or  AddRecCost... which has highest priority. But it is not always free in terms of ImmCost.

Narrowing profitable chains hits will lead to more Uses and exceed complexity limit. Which is not ok for RegNum...
So I don't think we should limit profitable chains somehow.

I don't see how I can increase ImmCost here:

  // Incrementing by zero or some constant is neutral. We assume constants can
  // be folded into an addressing mode or an add's immediate operand.
  if (isa<SCEVConstant>(Inc.IncExpr)) {
    ++NumConstIncrements;
    continue;
  }

If not count the same base address, I don't see how influence on ImmCost only.

> but I don't think again the averaging the fixups with the number of same base address is the right way to do it.

We can add just cost of base offset.

Anyway there is no much profit from this (just some code size). I noticed this unexpected behavior during testing.
And I'm ok to leave the code as is.


Repository:
  rL LLVM

https://reviews.llvm.org/D27321





More information about the llvm-commits mailing list