[PATCH] D101533: [TTI] NFC: Change getTypeLegalizationCost to return InstructionCost.

Sander de Smalen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 12:24:52 PDT 2021


sdesmalen added a comment.

In D101533#2726398 <https://reviews.llvm.org/D101533#2726398>, @dfukalov wrote:

> So what do you think, should I use `TargetLoweringBase::LegalizeCost` as type everywhere (and it doesn't seem clearer than `auto`) or just remove the new type and use `std::pair<InstructionCost, MVT>` everywhere?
>
> I just saw a number `auto LT = TLI->getTypeLegalizationCost()` in AArch64 backend and decided it is ok.

I agree with @kparzysz that the expanded form makes the code more readable, so that would have my preference in general. For this patch it's probably best to just follow precedent as to what was used before, i.e. cases that used `std::pair<unsigned, MVT>` should be changed to `std::pair<InstructionCost, MVT>`, and all cases that were already using `auto` to be left unchanged.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101533



More information about the llvm-commits mailing list