[llvm] [RISCV] Use llvm::is_contained (NFC) (PR #141372)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sat May 24 13:42:11 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/141372
None
>From 44e2617abce74067071ec7669622b4cd7edc7690 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 24 May 2025 09:25:02 -0700
Subject: [PATCH] [RISCV] Use llvm::is_contained (NFC)
---
llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
index 470ebcbc83aff..59d99e613c0f4 100644
--- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp
@@ -573,16 +573,12 @@ getPushOrLibCallsSavedInfo(const MachineFunction &MF,
// `QC.CM.PUSH(FP)`. In these cases, prioritise the CFI info that points
// to the versions saved by `QC.C.MIENTER(.NEST)` which is what FP
// unwinding would use.
- const auto *FII = llvm::find_if(FixedCSRFIQCIInterruptMap, [&](auto P) {
- return P.first == CS.getReg();
- });
- if (FII != std::end(FixedCSRFIQCIInterruptMap))
+ if (llvm::is_contained(llvm::make_first_range(FixedCSRFIQCIInterruptMap),
+ CS.getReg()))
continue;
}
- const auto *FII = llvm::find_if(
- FixedCSRFIMap, [&](MCPhysReg P) { return P == CS.getReg(); });
- if (FII != std::end(FixedCSRFIMap))
+ if (llvm::is_contained(FixedCSRFIMap, CS.getReg()))
PushOrLibCallsCSI.push_back(CS);
}
@@ -599,10 +595,8 @@ getQCISavedInfo(const MachineFunction &MF,
return QCIInterruptCSI;
for (const auto &CS : CSI) {
- const auto *FII = llvm::find_if(FixedCSRFIQCIInterruptMap, [&](auto P) {
- return P.first == CS.getReg();
- });
- if (FII != std::end(FixedCSRFIQCIInterruptMap))
+ if (llvm::is_contained(llvm::make_first_range(FixedCSRFIQCIInterruptMap),
+ CS.getReg()))
QCIInterruptCSI.push_back(CS);
}
More information about the llvm-commits
mailing list