[PATCH] D102541: [TTI] NFC: Change getRegUsageForType to return InstructionCost.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 20 03:44:53 PDT 2021


sdesmalen accepted this revision.
sdesmalen added a comment.
This revision is now accepted and ready to land.

LGTM, thanks!

In D102541#2761027 <https://reviews.llvm.org/D102541#2761027>, @dfukalov wrote:

> @sdesmalen this is needed to return from `getTypeLegalizationCost()` invalid costs, so at some point invalid legalization should be processed to a reg usage value, instead of asserting in `Optional<>::getValue()`.
> What do you think, should it be processed explicitly in LV or yet in BasicTTIImplBase<>::getRegUsageForType?

IMHO the further up we can propagate the InstructionCost value the better, so I'm happy how you've done it in this patch. I guess we could still consider propagating it further to the uses of `GetRegUsage`, but right now I think it's safe to assume that the VFs coming into this function must be legal VFs for the target, and so if all element types are legal for scalable vectors (D102253 <https://reviews.llvm.org/D102253>), then any VectorType with an element count of VF should be legal, or at least possible to legalize. And therefore the InstructionCost should never be Invalid.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D102541



More information about the llvm-commits mailing list