diff options
author | Justin Lebar <justin.lebar@gmail.com> | 2024-03-10 20:00:13 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-10 20:00:13 -0700 |
commit | fab2bb8bfda865bd438dee981d7be7df8017b76d (patch) | |
tree | 358f27c327a6eb2628f357f08910d3f6ee903ac9 /llvm/utils | |
parent | 6bec4fc76de50a090d1d0b36498da66c4a324851 (diff) | |
download | llvm-fab2bb8bfda865bd438dee981d7be7df8017b76d.zip llvm-fab2bb8bfda865bd438dee981d7be7df8017b76d.tar.gz llvm-fab2bb8bfda865bd438dee981d7be7df8017b76d.tar.bz2 |
Add llvm::min/max_element and use it in llvm/ and mlir/ directories. (#84678)
For some reason this was missing from STLExtras.
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/FileCheck/FileCheck.cpp | 13 | ||||
-rw-r--r-- | llvm/utils/TableGen/CodeGenSchedule.cpp | 2 | ||||
-rw-r--r-- | llvm/utils/TableGen/RegisterInfoEmitter.cpp | 4 |
3 files changed, 7 insertions, 12 deletions
diff --git a/llvm/utils/FileCheck/FileCheck.cpp b/llvm/utils/FileCheck/FileCheck.cpp index e74a79e..a962518 100644 --- a/llvm/utils/FileCheck/FileCheck.cpp +++ b/llvm/utils/FileCheck/FileCheck.cpp @@ -742,20 +742,15 @@ int main(int argc, char **argv) { // In the latter case, the general rule of thumb is to choose the value that // provides the most information. DumpInputValue DumpInput = - DumpInputs.empty() - ? DumpInputFail - : *std::max_element(DumpInputs.begin(), DumpInputs.end()); + DumpInputs.empty() ? DumpInputFail : *llvm::max_element(DumpInputs); DumpInputFilterValue DumpInputFilter; if (DumpInputFilters.empty()) DumpInputFilter = DumpInput == DumpInputAlways ? DumpInputFilterAll : DumpInputFilterError; else - DumpInputFilter = - *std::max_element(DumpInputFilters.begin(), DumpInputFilters.end()); - unsigned DumpInputContext = DumpInputContexts.empty() - ? 5 - : *std::max_element(DumpInputContexts.begin(), - DumpInputContexts.end()); + DumpInputFilter = *llvm::max_element(DumpInputFilters); + unsigned DumpInputContext = + DumpInputContexts.empty() ? 5 : *llvm::max_element(DumpInputContexts); if (DumpInput == DumpInputHelp) { DumpInputAnnotationHelp(outs()); diff --git a/llvm/utils/TableGen/CodeGenSchedule.cpp b/llvm/utils/TableGen/CodeGenSchedule.cpp index d819016..0e81623 100644 --- a/llvm/utils/TableGen/CodeGenSchedule.cpp +++ b/llvm/utils/TableGen/CodeGenSchedule.cpp @@ -287,7 +287,7 @@ static APInt constructOperandMask(ArrayRef<int64_t> Indices) { if (Indices.empty()) return OperandMask; - int64_t MaxIndex = *std::max_element(Indices.begin(), Indices.end()); + int64_t MaxIndex = *llvm::max_element(Indices); assert(MaxIndex >= 0 && "Invalid negative indices in input!"); OperandMask = OperandMask.zext(MaxIndex + 1); for (const int64_t Index : Indices) { diff --git a/llvm/utils/TableGen/RegisterInfoEmitter.cpp b/llvm/utils/TableGen/RegisterInfoEmitter.cpp index 8919e07..d074e31 100644 --- a/llvm/utils/TableGen/RegisterInfoEmitter.cpp +++ b/llvm/utils/TableGen/RegisterInfoEmitter.cpp @@ -803,8 +803,8 @@ void RegisterInfoEmitter::emitComposeSubRegIndexLaneMask( OS << " // Sequence " << Idx << "\n"; Idx += Sequence.size() + 1; } - auto *IntType = getMinimalTypeForRange(*std::max_element( - SubReg2SequenceIndexMap.begin(), SubReg2SequenceIndexMap.end())); + auto *IntType = + getMinimalTypeForRange(*llvm::max_element(SubReg2SequenceIndexMap)); OS << " };\n" " static const " << IntType << " CompositeSequences[] = {\n"; |