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

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 29 09:25:27 PDT 2021


kparzysz added inline comments.


================
Comment at: llvm/include/llvm/CodeGen/BasicTTIImpl.h:753
 
-    std::pair<unsigned, MVT> LT = TLI->getTypeLegalizationCost(DL, Ty);
+    const auto LT = TLI->getTypeLegalizationCost(DL, Ty);
 
----------------
sdesmalen wrote:
> AIUI, the LLVM coding standard favours `std::pair<InstructionCost, MVT>` over `auto`, since it's not obvious from the call to `TLI->getTypeLegalizationCost` what the returned type is.
> 
> (same for other instances in this file)
I was going to make a similar comment, but the actual type is `LegalizeCost` (which happens to be the pair).  Since `LegalizeCost` is defined in `TargetLoweringBase`, it would have to be `TargetLowering::LegalizeCost` everywhere.  Since it's fairly long, I thought that `const auto` would be ok, but I agree that spelling out the type would make the code a bit clearer.


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