[PATCH] D92238: [SCEVExpander] Migrate costAndCollectOperands to use InstructionCost.

Christopher Tetreault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 5 11:00:59 PST 2021


ctetreau added a comment.

In D92238#2452418 <https://reviews.llvm.org/D92238#2452418>, @lebedev.ri wrote:

> I think this is conflating use-cases.
> I'm not sure the entire `InstructionCost` should be used as a variable to track full/remaining cost over a several instructions.
> Perhaps there should be a[nother] abstraction for that?

Really, we were already doing this; we just didn't have a special cost type. We could leave the cost as an integer, but then the code would just become way more verbose (unwrapping every InstructionCost after computing them). Using the metaphor of money, a cost is a quantity of money. I think it's reasonable to subtract money from a budget. I suppose we could accumulate a running cost, and compare it with the budget that remains an integer, but that would just introduce another variable for (IMO) no good reason.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92238/new/

https://reviews.llvm.org/D92238



More information about the llvm-commits mailing list