[llvm] 59723e4 - [Target] Use llvm::is_contained (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 18 12:44:05 PDT 2023
Author: Kazu Hirata
Date: 2023-06-18T12:44:00-07:00
New Revision: 59723e401bcad2650bcbfc39e7fe8479dfc7f62b
URL: https://github.com/llvm/llvm-project/commit/59723e401bcad2650bcbfc39e7fe8479dfc7f62b
DIFF: https://github.com/llvm/llvm-project/commit/59723e401bcad2650bcbfc39e7fe8479dfc7f62b.diff
LOG: [Target] Use llvm::is_contained (NFC)
Added:
Modified:
llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
index 05daa3bfff543..55ddad2378ac9 100644
--- a/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonInstrInfo.cpp
@@ -2219,15 +2219,11 @@ bool HexagonInstrInfo::isDependent(const MachineInstr &ProdMI,
if (RegA == RegB)
return true;
- if (RegA.isPhysical())
- for (MCPhysReg SubReg : HRI.subregs(RegA))
- if (RegB == SubReg)
- return true;
-
- if (RegB.isPhysical())
- for (MCPhysReg SubReg : HRI.subregs(RegB))
- if (RegA == SubReg)
- return true;
+ if (RegA.isPhysical() && llvm::is_contained(HRI.subregs(RegA), RegB))
+ return true;
+
+ if (RegB.isPhysical() && llvm::is_contained(HRI.subregs(RegB), RegA))
+ return true;
}
return false;
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
index 4c3c7feff35ff..fd510f85a8a37 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyDebugValueManager.cpp
@@ -107,7 +107,7 @@ WebAssemblyDebugValueManager::getSinkableDebugValues(
SmallDenseMap<DebugVariable, SmallVector<MachineInstr *, 2>>
SeenDbgVarToDbgValues;
for (auto *DV : DbgValuesInBetween) {
- if (std::find(DbgValues.begin(), DbgValues.end(), DV) == DbgValues.end()) {
+ if (!llvm::is_contained(DbgValues, DV)) {
DebugVariable Var(DV->getDebugVariable(), DV->getDebugExpression(),
DV->getDebugLoc()->getInlinedAt());
SeenDbgVarToDbgValues[Var].push_back(DV);
@@ -220,7 +220,7 @@ bool WebAssemblyDebugValueManager::isInsertSamePlace(
for (MachineBasicBlock::iterator MI = std::next(Def->getIterator()),
ME = Insert;
MI != ME; ++MI) {
- if (std::find(DbgValues.begin(), DbgValues.end(), MI) == DbgValues.end()) {
+ if (!llvm::is_contained(DbgValues, MI)) {
return false;
}
}
More information about the llvm-commits
mailing list