[PATCH] D97382: NFC: Migrate PartialInlining to work on InstructionCost
    Christopher Tetreault via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Mar  4 14:23:40 PST 2021
    
    
  
ctetreau added inline comments.
================
Comment at: llvm/include/llvm/Support/InstructionCost.h:205-209
+  InstructionCost map(const std::function<CostType(const CostType &)> &F) {
+    if (isValid())
+      return InstructionCost(F(*getValue()));
+    return getInvalid();
+  }
----------------
ctetreau wrote:
> Having the function type be a template parameter (as it is defined in Optional.h) is preferred because lambda types can be directly used without the indirection of assigning them to a std::function. It also avoids having to `#include <functional>`
also, I believe map can be const.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97382/new/
https://reviews.llvm.org/D97382
    
    
More information about the llvm-commits
mailing list