[PATCH] D97466: NFC: Change getUserCost to return InstructionCost

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 25 09:41:22 PST 2021


paulwalker-arm added inline comments.


================
Comment at: llvm/include/llvm/Support/InstructionCost.h:213-221
+inline bool operator==(const InstructionCost::CostType LHS,
+                       const InstructionCost &RHS) {
+  return RHS == LHS;
+}
+
+inline bool operator!=(const InstructionCost::CostType LHS,
+                       const InstructionCost &RHS) {
----------------
Are these strictly necessary? I'm wondering if there's just the odd comparison somewhere whose operands can be switched.

Or is it the case that these are a temporary measure that will be removed once the current LHS becomes an InstructionCost?  If so I think it's worth adding a `//TODO: Remove me when...`


================
Comment at: llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp:2155
   // inlining.
-  unsigned Cost = 0;
+  InstructionCost Cost = 0;
   for (auto *BB : L->getBlocks()) {
----------------
More of an open question but is this initialisation required/preferred? Or to put another way, what is the expected meaning of InstructionCost()? Invalid? Zero?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97466



More information about the llvm-commits mailing list