[llvm] [LiveRegUnits] Remove use of std::function from phys_regs_and_masks (PR #65615)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 7 07:56:38 PDT 2023
https://github.com/jayfoad created https://github.com/llvm/llvm-project/pull/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/
>From 316bf4605e2d949906fd26640eba06225c58c7f8 Mon Sep 17 00:00:00 2001
From: Jay Foad <jay.foad at amd.com>
Date: Thu, 7 Sep 2023 14:27:27 +0100
Subject: [PATCH] [LiveRegUnits] Remove use of std::function from
phys_regs_and_masks
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/
---
llvm/include/llvm/CodeGen/LiveRegUnits.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
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