Skip to content

Commit

Permalink
[LiveRegUnits] Remove use of std::function from phys_regs_and_masks (#…
Browse files Browse the repository at this point in the history
…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/
  • Loading branch information
jayfoad committed Sep 7, 2023
1 parent 211da3f commit 1bd0485
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions llvm/include/llvm/CodeGen/LiveRegUnits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1bd0485

Please sign in to comment.