Skip to content

Commit 197c3a3

Browse files
Use llvm::less_first (NFC) (#94136)
1 parent b6ea134 commit 197c3a3

File tree

6 files changed

+7
-23
lines changed

6 files changed

+7
-23
lines changed

clang/lib/Serialization/ASTWriter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3205,9 +3205,7 @@ void ASTWriter::WritePragmaDiagnosticMappings(const DiagnosticsEngine &Diag,
32053205
}
32063206

32073207
// Sort by diag::kind for deterministic output.
3208-
llvm::sort(Mappings, [](const auto &LHS, const auto &RHS) {
3209-
return LHS.first < RHS.first;
3210-
});
3208+
llvm::sort(Mappings, llvm::less_first());
32113209

32123210
for (const auto &I : Mappings) {
32133211
Record.push_back(I.first);

clang/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,7 @@ static void canonicalizeDefines(PreprocessorOptions &PPOpts) {
259259
++Index;
260260
}
261261

262-
llvm::stable_sort(SimpleNames, [](const MacroOpt &A, const MacroOpt &B) {
263-
return A.first < B.first;
264-
});
262+
llvm::stable_sort(SimpleNames, llvm::less_first());
265263
// Keep the last instance of each macro name by going in reverse
266264
auto NewEnd = std::unique(
267265
SimpleNames.rbegin(), SimpleNames.rend(),

llvm/lib/MC/MCPseudoProbe.cpp

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,13 +182,10 @@ void MCPseudoProbeInlineTree::emit(MCObjectStreamer *MCOS,
182182
// Emit sorted descendant. InlineSite is unique for each pair, so there will
183183
// be no ordering of Inlinee based on MCPseudoProbeInlineTree*
184184
using InlineeType = std::pair<InlineSite, MCPseudoProbeInlineTree *>;
185-
auto Comparer = [](const InlineeType &A, const InlineeType &B) {
186-
return A.first < B.first;
187-
};
188185
std::vector<InlineeType> Inlinees;
189186
for (const auto &Child : Children)
190187
Inlinees.emplace_back(Child.first, Child.second.get());
191-
std::sort(Inlinees.begin(), Inlinees.end(), Comparer);
188+
llvm::sort(Inlinees, llvm::less_first());
192189

193190
for (const auto &Inlinee : Inlinees) {
194191
// Emit probe index
@@ -230,13 +227,10 @@ void MCPseudoProbeSections::emit(MCObjectStreamer *MCOS) {
230227
// Emit sorted descendant. InlineSite is unique for each pair, so there
231228
// will be no ordering of Inlinee based on MCPseudoProbeInlineTree*
232229
using InlineeType = std::pair<InlineSite, MCPseudoProbeInlineTree *>;
233-
auto Comparer = [](const InlineeType &A, const InlineeType &B) {
234-
return A.first < B.first;
235-
};
236230
std::vector<InlineeType> Inlinees;
237231
for (const auto &Child : Root.getChildren())
238232
Inlinees.emplace_back(Child.first, Child.second.get());
239-
std::sort(Inlinees.begin(), Inlinees.end(), Comparer);
233+
llvm::sort(Inlinees, llvm::less_first());
240234

241235
for (const auto &Inlinee : Inlinees) {
242236
// Emit the group guarded by a sentinel probe.

llvm/lib/Target/AMDGPU/SIMachineFunctionInfo.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -597,10 +597,7 @@ class SIMachineFunctionInfo final : public AMDGPUMachineFunction,
597597
const ReservedRegSet &getWWMReservedRegs() const { return WWMReservedRegs; }
598598

599599
ArrayRef<PrologEpilogSGPRSpill> getPrologEpilogSGPRSpills() const {
600-
assert(
601-
is_sorted(PrologEpilogSGPRSpills, [](const auto &LHS, const auto &RHS) {
602-
return LHS.first < RHS.first;
603-
}));
600+
assert(is_sorted(PrologEpilogSGPRSpills, llvm::less_first()));
604601
return PrologEpilogSGPRSpills;
605602
}
606603

mlir/lib/Dialect/SparseTensor/Transforms/SparseReinterpretMap.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -557,9 +557,7 @@ struct GenericOpScheduler : public OpRewritePattern<linalg::GenericOp> {
557557
unsigned lvl = llvm::cast<AffineDimExpr>(expr).getPosition();
558558
lvlSeq.push_back(std::make_pair(lvl, lvlSeq.size()));
559559
}
560-
std::sort(lvlSeq.begin(), lvlSeq.end(), [](auto &lhs, auto &rhs) -> bool {
561-
return lhs.first < rhs.first;
562-
});
560+
llvm::sort(lvlSeq, llvm::less_first());
563561
SmallVector<unsigned> perm =
564562
llvm::to_vector(llvm::make_second_range(lvlSeq));
565563
auto dimToLvl = AffineMap::getPermutationMap(perm, linalgOp.getContext());

mlir/lib/Dialect/SparseTensor/Transforms/Utils/LoopEmitter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ void LoopEmitter::initialize(ValueRange ts, StringAttr loopTag, bool hasOutput,
184184
for (Level l = 0; l < lvlRank; l++) {
185185
std::vector<std::pair<LoopId, unsigned>> deps = dimGetter(tid, l);
186186
// Sort the loop by order.
187-
std::sort(deps.begin(), deps.end(),
188-
[](auto &lhs, auto &rhs) { return lhs.first < rhs.first; });
187+
llvm::sort(deps, llvm::less_first());
189188

190189
dependentLvlMap[tid][l] = std::move(deps);
191190
unsigned depends = dependentLvlMap[tid][l].size();

0 commit comments

Comments
 (0)