[llvm] b05bc1f - [CodeGen][NFC] Replace std::function with llvm::function_ref (#228431)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 06:56:47 PDT 2026
Author: Tim Gymnich
Date: 2026-10-02T13:56:39Z
New Revision: b05bc1f7066a5298bbae9b438bbf6942015536df
URL: https://github.com/llvm/llvm-project/commit/b05bc1f7066a5298bbae9b438bbf6942015536df
DIFF: https://github.com/llvm/llvm-project/commit/b05bc1f7066a5298bbae9b438bbf6942015536df.diff
LOG: [CodeGen][NFC] Replace std::function with llvm::function_ref (#228431)
Replace `std::function` with `llvm::function_ref` for a perdicate
parameter that is only used during the call.
Added:
Modified:
llvm/include/llvm/CodeGen/GlobalISel/Utils.h
llvm/lib/CodeGen/GlobalISel/Utils.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
index 7b339211cc3ca3..30af31e103e6b8 100644
--- a/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
+++ b/llvm/include/llvm/CodeGen/GlobalISel/Utils.h
@@ -563,7 +563,7 @@ isConstantOrConstantSplatVectorFP(Register Def, const MachineRegisterInfo &MRI);
/// value was undef.
LLVM_ABI bool
matchUnaryPredicate(const MachineRegisterInfo &MRI, Register Reg,
- std::function<bool(const Constant *ConstVal)> Match,
+ llvm::function_ref<bool(const Constant *ConstVal)> Match,
bool AllowUndefs = false);
/// Returns true if given the TargetLowering's boolean contents information,
diff --git a/llvm/lib/CodeGen/GlobalISel/Utils.cpp b/llvm/lib/CodeGen/GlobalISel/Utils.cpp
index d0cc4a823d7f5f..9a369bbdced1ad 100644
--- a/llvm/lib/CodeGen/GlobalISel/Utils.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/Utils.cpp
@@ -1571,7 +1571,8 @@ bool llvm::isAllOnesOrAllOnesSplat(const MachineInstr &MI,
bool llvm::matchUnaryPredicate(
const MachineRegisterInfo &MRI, Register Reg,
- std::function<bool(const Constant *ConstVal)> Match, bool AllowUndefs) {
+ llvm::function_ref<bool(const Constant *ConstVal)> Match,
+ bool AllowUndefs) {
const MachineInstr *Def = getDefIgnoringCopies(Reg, MRI);
if (AllowUndefs && Def->getOpcode() == TargetOpcode::G_IMPLICIT_DEF)
More information about the llvm-commits
mailing list