[llvm] 1bd0485 - [LiveRegUnits] Remove use of std::function from phys_regs_and_masks (#65615)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 7 08:34:31 PDT 2023
Author: Jay Foad
Date: 2023-09-07T16:34:26+01:00
New Revision: 1bd048532610e14a8bb19c2f6b90ecac093cec67
URL: https://github.com/llvm/llvm-project/commit/1bd048532610e14a8bb19c2f6b90ecac093cec67
DIFF: https://github.com/llvm/llvm-project/commit/1bd048532610e14a8bb19c2f6b90ecac093cec67.diff
LOG: [LiveRegUnits] Remove use of std::function from phys_regs_and_masks (#65615)
This removes some std::function boilerplate from my profile of the
most frequently called functions in llc. The geomean speed up of 0.01%
just barely shows up on https://llvm-compile-time-tracker.com/
Added:
Modified:
llvm/include/llvm/CodeGen/LiveRegUnits.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/LiveRegUnits.h b/llvm/include/llvm/CodeGen/LiveRegUnits.h
index d554493e629ed3..e96165d6b3bbf3 100644
--- a/llvm/include/llvm/CodeGen/LiveRegUnits.h
+++ b/llvm/include/llvm/CodeGen/LiveRegUnits.h
@@ -161,15 +161,15 @@ class LiveRegUnits {
/// Returns an iterator range over all physical register and mask operands for
/// \p MI and bundled instructions. This also skips any debug operands.
-inline iterator_range<filter_iterator<
- ConstMIBundleOperands, std::function<bool(const MachineOperand &)>>>
+inline iterator_range<
+ filter_iterator<ConstMIBundleOperands, bool (*)(const MachineOperand &)>>
phys_regs_and_masks(const MachineInstr &MI) {
- std::function<bool(const MachineOperand &)> Pred =
- [](const MachineOperand &MOP) {
- return MOP.isRegMask() ||
- (MOP.isReg() && !MOP.isDebug() && MOP.getReg().isPhysical());
- };
- return make_filter_range(const_mi_bundle_ops(MI), Pred);
+ auto Pred = [](const MachineOperand &MOP) {
+ return MOP.isRegMask() ||
+ (MOP.isReg() && !MOP.isDebug() && MOP.getReg().isPhysical());
+ };
+ return make_filter_range(const_mi_bundle_ops(MI),
+ static_cast<bool (*)(const MachineOperand &)>(Pred));
}
} // end namespace llvm
More information about the llvm-commits
mailing list