Skip to content

[CodeGen] Use llvm::append_range (NFC) #133603

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1477,8 +1477,7 @@ static uint64_t getOffsetFromIndices(const User &U, const DataLayout &DL) {
for (auto Idx : IVI->indices())
Indices.push_back(ConstantInt::get(Int32Ty, Idx));
} else {
for (Value *Op : drop_begin(U.operands()))
Indices.push_back(Op);
llvm::append_range(Indices, drop_begin(U.operands()));
}

return 8 * static_cast<uint64_t>(
Expand Down Expand Up @@ -2212,8 +2211,7 @@ bool IRTranslator::translateKnownIntrinsic(const CallInst &CI, Intrinsic::ID ID,
case Intrinsic::fake_use: {
SmallVector<llvm::SrcOp, 4> VRegs;
for (const auto &Arg : CI.args())
for (auto VReg : getOrCreateVRegs(*Arg))
VRegs.push_back(VReg);
llvm::append_range(VRegs, getOrCreateVRegs(*Arg));
MIRBuilder.buildInstr(TargetOpcode::FAKE_USE, {}, VRegs);
MF->setHasFakeUses(true);
return true;
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/GlobalISel/LegalizerHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4906,8 +4906,7 @@ LegalizerHelper::fewerElementsVectorMultiEltType(
SmallVector<Register, 8> SplitPieces;
extractVectorParts(MI.getReg(UseIdx), NumElts, SplitPieces, MIRBuilder,
MRI);
for (auto Reg : SplitPieces)
InputOpsPieces[UseNo].push_back(Reg);
llvm::append_range(InputOpsPieces[UseNo], SplitPieces);
}
}

Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4218,9 +4218,7 @@ std::optional<ValueIDNum> InstrRefBasedLDV::resolveDbgPHIsImpl(
}

// Sort PHIs to validate into RPO-order.
SmallVector<LDVSSAPhi *, 8> SortedPHIs;
for (auto &PHI : CreatedPHIs)
SortedPHIs.push_back(PHI);
SmallVector<LDVSSAPhi *, 8> SortedPHIs(CreatedPHIs);

llvm::sort(SortedPHIs, [&](LDVSSAPhi *A, LDVSSAPhi *B) {
return BBToOrder[&A->getParent()->BB] < BBToOrder[&B->getParent()->BB];
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/MachineSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2326,8 +2326,7 @@ bool PostRAMachineSinking::tryToSinkCopy(MachineBasicBlock &CurBB,
for (MCRegUnit Unit : TRI->regunits(MO.getReg())) {
for (const auto &MIRegs : SeenDbgInstrs.lookup(Unit)) {
auto &Regs = DbgValsToSinkMap[MIRegs.first];
for (Register Reg : MIRegs.second)
Regs.push_back(Reg);
llvm::append_range(Regs, MIRegs.second);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/RegAllocGreedy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2195,8 +2195,7 @@ MCRegister RAGreedy::tryLastChanceRecoloring(
if (tryRecoloringCandidates(RecoloringQueue, CurrentNewVRegs,
FixedRegisters, RecolorStack, Depth)) {
// Push the queued vregs into the main queue.
for (Register NewVReg : CurrentNewVRegs)
NewVRegs.push_back(NewVReg);
llvm::append_range(NewVRegs, CurrentNewVRegs);
// Do not mess up with the global assignment process.
// I.e., VirtReg must be unassigned.
if (VRM->hasPhys(ThisVirtReg)) {
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectOptimize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,7 @@ void SelectOptimizeImpl::optimizeSelectsInnerLoops(Function &F,
SmallVector<Loop *, 4> Loops(LI->begin(), LI->end());
// Need to check size on each iteration as we accumulate child loops.
for (unsigned long i = 0; i < Loops.size(); ++i)
for (Loop *ChildL : Loops[i]->getSubLoops())
Loops.push_back(ChildL);
llvm::append_range(Loops, Loops[i]->getSubLoops());

for (Loop *L : Loops) {
if (!L->isInnermost())
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1195,8 +1195,7 @@ EmitMachineNode(SDNode *Node, bool IsClone, bool IsCloned,
// Add rounding control registers as implicit def for function call.
if (II.isCall() && MF->getFunction().hasFnAttribute(Attribute::StrictFP)) {
ArrayRef<MCPhysReg> RCRegs = TLI->getRoundingControlRegisters();
for (MCPhysReg Reg : RCRegs)
UsedRegs.push_back(Reg);
llvm::append_range(UsedRegs, RCRegs);
}

// Finally mark unused registers as dead.
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/SelectionDAG/SDNodeDbgValue.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ class SDDbgValue {
for (const SDDbgOperand &DbgOp : getLocationOps())
if (DbgOp.getKind() == SDDbgOperand::SDNODE)
Dependencies.push_back(DbgOp.getSDNode());
for (SDNode *Node : getAdditionalDependencies())
Dependencies.push_back(Node);
llvm::append_range(Dependencies, getAdditionalDependencies());
return Dependencies;
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/CodeGen/WindowScheduler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,7 @@ void WindowScheduler::restoreMBB() {
MI.eraseFromParent();
}
// Restore MBB to the state before window scheduling.
for (auto *MI : OriMIs)
MBB->push_back(MI);
llvm::append_range(*MBB, OriMIs);
updateLiveIntervals();
}

Expand Down