Skip to content

Commit ce8c228

Browse files
Use llvm::drop_begin and llvm::drop_end (NFC)
1 parent 3bca659 commit ce8c228

File tree

6 files changed

+9
-13
lines changed

6 files changed

+9
-13
lines changed

clang/lib/AST/TextNodeDumper.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,8 +1901,7 @@ void TextNodeDumper::VisitFunctionDecl(const FunctionDecl *D) {
19011901
auto Overrides = MD->overridden_methods();
19021902
OS << "Overrides: [ ";
19031903
dumpOverride(*Overrides.begin());
1904-
for (const auto *Override :
1905-
llvm::make_range(Overrides.begin() + 1, Overrides.end())) {
1904+
for (const auto *Override : llvm::drop_begin(Overrides)) {
19061905
OS << ", ";
19071906
dumpOverride(Override);
19081907
}

llvm/lib/CodeGen/GlobalISel/Utils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1173,7 +1173,7 @@ llvm::getVectorSplat(const MachineInstr &MI, const MachineRegisterInfo &MRI) {
11731173
if (auto Splat = getIConstantSplatSExtVal(MI, MRI))
11741174
return RegOrConstant(*Splat);
11751175
auto Reg = MI.getOperand(1).getReg();
1176-
if (any_of(make_range(MI.operands_begin() + 2, MI.operands_end()),
1176+
if (any_of(drop_begin(MI.operands(), 2),
11771177
[&Reg](const MachineOperand &Op) { return Op.getReg() != Reg; }))
11781178
return std::nullopt;
11791179
return RegOrConstant(Reg);

llvm/lib/CodeGen/MachineCopyPropagation.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1147,11 +1147,11 @@ void MachineCopyPropagation::EliminateSpillageCopies(MachineBasicBlock &MBB) {
11471147
return;
11481148

11491149
// If violate property#2, we don't fold the chain.
1150-
for (const MachineInstr *Spill : make_range(SC.begin() + 1, SC.end()))
1150+
for (const MachineInstr *Spill : drop_begin(SC))
11511151
if (CopySourceInvalid.count(Spill))
11521152
return;
11531153

1154-
for (const MachineInstr *Reload : make_range(RC.begin(), RC.end() - 1))
1154+
for (const MachineInstr *Reload : drop_end(RC))
11551155
if (CopySourceInvalid.count(Reload))
11561156
return;
11571157

llvm/lib/IR/Instructions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ Value *PHINode::removeIncomingValue(unsigned Idx, bool DeletePHIIfEmpty) {
130130
// clients might not expect this to happen. The code as it is thrashes the
131131
// use/def lists, which is kinda lame.
132132
std::copy(op_begin() + Idx + 1, op_end(), op_begin() + Idx);
133-
copyIncomingBlocks(make_range(block_begin() + Idx + 1, block_end()), Idx);
133+
copyIncomingBlocks(drop_begin(blocks(), Idx + 1), Idx);
134134

135135
// Nuke the last value.
136136
Op<-1>().set(nullptr);

llvm/lib/MCA/Stages/EntryStage.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ llvm::Error EntryStage::cycleResume() {
6767

6868
llvm::Error EntryStage::cycleEnd() {
6969
// Find the first instruction which hasn't been retired.
70-
auto Range =
71-
make_range(Instructions.begin() + NumRetired, Instructions.end());
70+
auto Range = drop_begin(Instructions, NumRetired);
7271
auto It = find_if(Range, [](const std::unique_ptr<Instruction> &I) {
7372
return !I->isRetired();
7473
});

llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5517,11 +5517,9 @@ bool AArch64InstructionSelector::tryOptBuildVecToSubregToReg(
55175517
const RegisterBank &DstRB = *RBI.getRegBank(Dst, MRI, TRI);
55185518
if (EltRB != DstRB)
55195519
return false;
5520-
if (any_of(make_range(I.operands_begin() + 2, I.operands_end()),
5521-
[&MRI](const MachineOperand &Op) {
5522-
return !getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, Op.getReg(),
5523-
MRI);
5524-
}))
5520+
if (any_of(drop_begin(I.operands(), 2), [&MRI](const MachineOperand &Op) {
5521+
return !getOpcodeDef(TargetOpcode::G_IMPLICIT_DEF, Op.getReg(), MRI);
5522+
}))
55255523
return false;
55265524
unsigned SubReg;
55275525
const TargetRegisterClass *EltRC = getRegClassForTypeOnBank(EltTy, EltRB);

0 commit comments

Comments
 (0)