[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:01 PST 2021
ctetreau added a comment.
Aside from the function signature for InstructionCost::map, this patch looks good to me.
================
Comment at: llvm/include/llvm/Support/InstructionCost.h:21
#include "llvm/ADT/Optional.h"
+#include <functional>
----------------
if map takes a template parameter for the function type, then this should be unnecessary.
================
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();
+ }
----------------
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>`
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