Skip to content

[Target] Use llvm::append_range (NFC) #133606

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
Original file line number Diff line number Diff line change
Expand Up @@ -482,9 +482,7 @@ void applyExtUaddvToUaddlv(MachineInstr &MI, MachineRegisterInfo &MRI,
// the values inside a small vec
extractParts(SrcReg, SrcTy, MainTy, LeftoverTy, WorkingRegisters,
LeftoverRegs, B, MRI);
for (unsigned I = 0; I < LeftoverRegs.size(); I++) {
WorkingRegisters.push_back(LeftoverRegs[I]);
}
llvm::append_range(WorkingRegisters, LeftoverRegs);
} else {
WorkingRegisters.push_back(SrcReg);
MainTy = SrcTy;
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1265,9 +1265,7 @@ bool AMDGPUSwLowerLDS::run() {
for (Instruction *Inst : AsanInfo.Instructions) {
SmallVector<InterestingMemoryOperand, 1> InterestingOperands;
getInterestingMemoryOperands(M, Inst, InterestingOperands);
for (auto &Operand : InterestingOperands) {
OperandsToInstrument.push_back(Operand);
}
llvm::append_range(OperandsToInstrument, InterestingOperands);
}
for (auto &Operand : OperandsToInstrument) {
Value *Addr = Operand.getPtr();
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/ARMBaseInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6907,8 +6907,7 @@ bool ARMPipelinerLoopInfo::tooMuchRegisterPressure(SwingSchedulerDAG &SSD,
SMS.getInstructions(Cycle + Stage * SMS.getInitiationInterval());
std::sort(Instrs.begin(), Instrs.end(),
[](SUnit *A, SUnit *B) { return A->NodeNum > B->NodeNum; });
for (SUnit *SU : Instrs)
ProposedSchedule.push_back(SU);
llvm::append_range(ProposedSchedule, Instrs);
}

// Learn whether the last use/def of each cross-iteration register is a use or
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/MVETPAndVPTOptimisationsPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,7 @@ MachineInstr *MVETPAndVPTOptimisations::CheckForLRUseInPredecessors(
}

Visited.insert(MBB);
for (auto *Pred : MBB->predecessors())
Worklist.push_back(Pred);
llvm::append_range(Worklist, MBB->predecessors());
}
return LoopStart;
}
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/DirectX/DXILDataScalarization.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ bool DataScalarizerVisitor::visitGetElementPtrInst(GetElementPtrInst &GEPI) {
return false;

IRBuilder<> Builder(&GEPI);
SmallVector<Value *, MaxVecSize> Indices;
for (auto &Index : GEPI.indices())
Indices.push_back(Index);
SmallVector<Value *, MaxVecSize> Indices(GEPI.indices());

Value *NewGEP =
Builder.CreateGEP(NewGlobal->getValueType(), NewGlobal, Indices,
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/Hexagon/HexagonISelDAGToDAGHVX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1062,8 +1062,7 @@ static SmallVector<unsigned, 4> getInputSegmentList(ShuffleMask SM,
Segs.set(M >> Shift);
}

for (unsigned B : Segs.set_bits())
SegList.push_back(B);
llvm::append_range(SegList, Segs.set_bits());
return SegList;
}

Expand Down
14 changes: 4 additions & 10 deletions llvm/lib/Target/SPIRV/SPIRVEmitIntrinsics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1241,8 +1241,7 @@ void SPIRVEmitIntrinsics::preprocessCompositeConstants(IRBuilder<> &B) {
for (unsigned i = 0; i < COp->getNumElements(); ++i)
Args.push_back(COp->getElementAsConstant(i));
else
for (auto &COp : AggrConst->operands())
Args.push_back(COp);
llvm::append_range(Args, AggrConst->operands());
if (!BPrepared) {
IsPhi ? B.SetInsertPointPastAllocas(I->getParent()->getParent())
: B.SetInsertPoint(I);
Expand Down Expand Up @@ -1387,8 +1386,7 @@ Instruction *SPIRVEmitIntrinsics::visitGetElementPtrInst(GetElementPtrInst &I) {
SmallVector<Type *, 2> Types = {I.getType(), I.getOperand(0)->getType()};
SmallVector<Value *, 4> Args;
Args.push_back(B.getInt1(I.isInBounds()));
for (auto &Op : I.operands())
Args.push_back(Op);
llvm::append_range(Args, I.operands());
auto *NewI = B.CreateIntrinsic(Intrinsic::spv_gep, {Types}, {Args});
replaceAllUsesWithAndErase(B, &I, NewI);
return NewI;
Expand Down Expand Up @@ -1716,9 +1714,7 @@ Instruction *SPIRVEmitIntrinsics::visitExtractValueInst(ExtractValueInst &I) {
return &I;
IRBuilder<> B(I.getParent());
B.SetInsertPoint(&I);
SmallVector<Value *> Args;
for (auto &Op : I.operands())
Args.push_back(Op);
SmallVector<Value *> Args(I.operands());
for (auto &Op : I.indices())
Args.push_back(B.getInt32(Op));
auto *NewI =
Expand Down Expand Up @@ -1794,9 +1790,7 @@ Instruction *SPIRVEmitIntrinsics::visitAtomicCmpXchgInst(AtomicCmpXchgInst &I) {
assert(I.getType()->isAggregateType() && "Aggregate result is expected");
IRBuilder<> B(I.getParent());
B.SetInsertPoint(&I);
SmallVector<Value *> Args;
for (auto &Op : I.operands())
Args.push_back(Op);
SmallVector<Value *> Args(I.operands());
Args.push_back(B.getInt32(
static_cast<uint32_t>(getMemScope(I.getContext(), I.getSyncScopeID()))));
Args.push_back(B.getInt32(
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/SPIRV/SPIRVUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,8 +689,7 @@ bool sortBlocks(Function &F) {
Order.reserve(F.size());

ReversePostOrderTraversal<Function *> RPOT(&F);
for (BasicBlock *BB : RPOT)
Order.push_back(BB);
llvm::append_range(Order, RPOT);

assert(&*F.begin() == Order[0]);
BasicBlock *LastBlock = &*F.begin();
Expand Down Expand Up @@ -785,8 +784,7 @@ CallInst *buildIntrWithMD(Intrinsic::ID IntrID, ArrayRef<Type *> Types,
SmallVector<Value *, 4> Args;
Args.push_back(Arg2);
Args.push_back(buildMD(Arg));
for (auto *Imm : Imms)
Args.push_back(Imm);
llvm::append_range(Args, Imms);
return B.CreateIntrinsic(IntrID, {Types}, Args);
}

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/X86/X86CmovConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,7 @@ bool X86CmovConverterPass::runOnMachineFunction(MachineFunction &MF) {
// Note that we need to check size on each iteration as we accumulate child
// loops.
for (int i = 0; i < (int)Loops.size(); ++i)
for (MachineLoop *Child : Loops[i]->getSubLoops())
Loops.push_back(Child);
llvm::append_range(Loops, Loops[i]->getSubLoops());

for (MachineLoop *CurrLoop : Loops) {
// Optimize only innermost loops.
Expand Down
4 changes: 1 addition & 3 deletions llvm/lib/Target/X86/X86InterleavedAccess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,10 +829,8 @@ bool X86TargetLowering::lowerInterleavedStore(StoreInst *SI,

// Holds the indices of SVI that correspond to the starting index of each
// interleaved shuffle.
SmallVector<unsigned, 4> Indices;
auto Mask = SVI->getShuffleMask();
for (unsigned i = 0; i < Factor; i++)
Indices.push_back(Mask[i]);
SmallVector<unsigned, 4> Indices(Mask.take_front(Factor));

ArrayRef<ShuffleVectorInst *> Shuffles = ArrayRef(SVI);

Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/X86/X86WinEHState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,8 +721,7 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) {
// enqueue it's successors to see if we can infer their states.
InitialStates.insert({BB, PredState});
FinalStates.insert({BB, PredState});
for (BasicBlock *SuccBB : successors(BB))
Worklist.push_back(SuccBB);
llvm::append_range(Worklist, successors(BB));
}

// Try to hoist stores from successors.
Expand Down
Loading