Skip to content

Commit f890fd5

Browse files
[llvm] Use llvm::is_sorted (NFC)
1 parent f82b5a6 commit f890fd5

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

llvm/lib/Target/ARM/ARMConstantIslandPass.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,11 @@ char ARMConstantIslands::ID = 0;
297297
void ARMConstantIslands::verify() {
298298
#ifndef NDEBUG
299299
BBInfoVector &BBInfo = BBUtils->getBBInfo();
300-
assert(std::is_sorted(MF->begin(), MF->end(),
301-
[&BBInfo](const MachineBasicBlock &LHS,
300+
assert(is_sorted(*MF, [&BBInfo](const MachineBasicBlock &LHS,
302301
const MachineBasicBlock &RHS) {
303-
return BBInfo[LHS.getNumber()].postOffset() <
304-
BBInfo[RHS.getNumber()].postOffset();
305-
}));
302+
return BBInfo[LHS.getNumber()].postOffset() <
303+
BBInfo[RHS.getNumber()].postOffset();
304+
}));
306305
LLVM_DEBUG(dbgs() << "Verifying " << CPUsers.size() << " CP users.\n");
307306
for (unsigned i = 0, e = CPUsers.size(); i != e; ++i) {
308307
CPUser &U = CPUsers[i];

llvm/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -807,11 +807,11 @@ void ARMInstPrinter::printRegisterList(const MCInst *MI, unsigned OpNum,
807807
const MCSubtargetInfo &STI,
808808
raw_ostream &O) {
809809
if (MI->getOpcode() != ARM::t2CLRM) {
810-
assert(std::is_sorted(MI->begin() + OpNum, MI->end(),
811-
[&](const MCOperand &LHS, const MCOperand &RHS) {
812-
return MRI.getEncodingValue(LHS.getReg()) <
813-
MRI.getEncodingValue(RHS.getReg());
814-
}));
810+
assert(is_sorted(drop_begin(*MI, OpNum),
811+
[&](const MCOperand &LHS, const MCOperand &RHS) {
812+
return MRI.getEncodingValue(LHS.getReg()) <
813+
MRI.getEncodingValue(RHS.getReg());
814+
}));
815815
}
816816

817817
O << "{";

llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1730,11 +1730,11 @@ getRegisterListOpValue(const MCInst &MI, unsigned Op,
17301730
Binary |= NumRegs * 2;
17311731
} else {
17321732
const MCRegisterInfo &MRI = *CTX.getRegisterInfo();
1733-
assert(std::is_sorted(MI.begin() + Op, MI.end(),
1734-
[&](const MCOperand &LHS, const MCOperand &RHS) {
1735-
return MRI.getEncodingValue(LHS.getReg()) <
1733+
assert(is_sorted(drop_begin(MI, Op),
1734+
[&](const MCOperand &LHS, const MCOperand &RHS) {
1735+
return MRI.getEncodingValue(LHS.getReg()) <
17361736
MRI.getEncodingValue(RHS.getReg());
1737-
}));
1737+
}));
17381738
for (unsigned I = Op, E = MI.getNumOperands(); I < E; ++I) {
17391739
unsigned RegNo = MRI.getEncodingValue(MI.getOperand(I).getReg());
17401740
Binary |= 1 << RegNo;

llvm/lib/Target/X86/X86FloatingPoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ static int Lookup(ArrayRef<TableEntry> Table, unsigned Opcode) {
610610
{ \
611611
static std::atomic<bool> TABLE##Checked(false); \
612612
if (!TABLE##Checked.load(std::memory_order_relaxed)) { \
613-
assert(std::is_sorted(std::begin(TABLE), std::end(TABLE)) && \
613+
assert(is_sorted(TABLE) && \
614614
"All lookup tables must be sorted for efficient access!"); \
615615
TABLE##Checked.store(true, std::memory_order_relaxed); \
616616
} \

0 commit comments

Comments
 (0)