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

Evgeny Stupachenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 2 11:54:05 PST 2016


evstupac added a comment.

Hi,

Thanks for taking a look.

> You are saying that we want to account for an extra cost if the setting outside of the base is big, right?

No. I just want correct behavior from current algorithm. LSR already take in account ImmCost, but do this incorrectly for "profitable chains".
When we do "CollectFixupsAndInitialFormulae()":
(line 2969) // Skip IV users that are part of profitable IV Chains.
We do not insert Fixups for memory instructions in the "profitable chain" and therefore do not count ImmCost for them in RateFormula():
(line 1156) for (const LSRFixup &Fixup : LU.Fixups) {

> Then, why is the average offset relevant to answer that question?

As there is no exact Offset (see above) we can only estimate.

Thanks,
Evgeny


Repository:
  rL LLVM

https://reviews.llvm.org/D27321





More information about the llvm-commits mailing list