Skip to content

Commit cc7a238

Browse files
[Target] Use llvm::append_range (NFC)
1 parent 2f1ffa9 commit cc7a238

12 files changed

+22
-44
lines changed

llvm/lib/Target/AMDGPU/AMDGPUAlwaysInlinePass.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ recursivelyVisitUsers(GlobalValue &GV,
8181
continue;
8282
}
8383

84-
for (User *UU : U->users())
85-
Stack.push_back(UU);
84+
append_range(Stack, U->users());
8685
}
8786
}
8887

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6208,12 +6208,10 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
62086208
SmallVector<SDValue, 26> Ops;
62096209
if (BaseOpcode->Store || BaseOpcode->Atomic)
62106210
Ops.push_back(VData); // vdata
6211-
if (UseNSA) {
6212-
for (const SDValue &Addr : VAddrs)
6213-
Ops.push_back(Addr);
6214-
} else {
6211+
if (UseNSA)
6212+
append_range(Ops, VAddrs);
6213+
else
62156214
Ops.push_back(VAddr);
6216-
}
62176215
Ops.push_back(Op.getOperand(ArgOffset + Intr->RsrcIndex));
62186216
if (BaseOpcode->Sampler)
62196217
Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex));

llvm/lib/Target/AMDGPU/SILowerI1Copies.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,8 @@ class PhiIncomingAnalysis {
177177
}
178178
}
179179

180-
if (Divergent && PDT.dominates(&DefBlock, MBB)) {
181-
for (MachineBasicBlock *Succ : MBB->successors())
182-
Stack.push_back(Succ);
183-
}
180+
if (Divergent && PDT.dominates(&DefBlock, MBB))
181+
append_range(Stack, MBB->successors());
184182
}
185183

186184
while (!Stack.empty()) {
@@ -189,8 +187,7 @@ class PhiIncomingAnalysis {
189187
continue;
190188
ReachableOrdered.push_back(MBB);
191189

192-
for (MachineBasicBlock *Succ : MBB->successors())
193-
Stack.push_back(Succ);
190+
append_range(Stack, MBB->successors());
194191
}
195192

196193
for (MachineBasicBlock *MBB : ReachableOrdered) {

llvm/lib/Target/ARM/ARMISelLowering.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3556,8 +3556,7 @@ static bool allUsersAreInFunction(const Value *V, const Function *F) {
35563556
while (!Worklist.empty()) {
35573557
auto *U = Worklist.pop_back_val();
35583558
if (isa<ConstantExpr>(U)) {
3559-
for (auto *UU : U->users())
3560-
Worklist.push_back(UU);
3559+
append_range(Worklist, U->users());
35613560
continue;
35623561
}
35633562

@@ -19126,8 +19125,7 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI,
1912619125

1912719126
SmallVector<Value *, 6> Ops;
1912819127
Ops.push_back(Builder.CreateBitCast(BaseAddr, Int8Ptr));
19129-
for (auto S : Shuffles)
19130-
Ops.push_back(S);
19128+
append_range(Ops, Shuffles);
1913119129
Ops.push_back(Builder.getInt32(SI->getAlignment()));
1913219130
Builder.CreateCall(VstNFunc, Ops);
1913319131
} else {
@@ -19143,8 +19141,7 @@ bool ARMTargetLowering::lowerInterleavedStore(StoreInst *SI,
1914319141

1914419142
SmallVector<Value *, 6> Ops;
1914519143
Ops.push_back(Builder.CreateBitCast(BaseAddr, EltPtrTy));
19146-
for (auto S : Shuffles)
19147-
Ops.push_back(S);
19144+
append_range(Ops, Shuffles);
1914819145
for (unsigned F = 0; F < Factor; F++) {
1914919146
Ops.push_back(Builder.getInt32(F));
1915019147
Builder.CreateCall(VstNFunc, Ops);

llvm/lib/Target/ARM/ARMLowOverheadLoops.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ namespace {
143143
// Insert exit blocks.
144144
SmallVector<MachineBasicBlock*, 2> ExitBlocks;
145145
ML.getExitBlocks(ExitBlocks);
146-
for (auto *MBB : ExitBlocks)
147-
Order.push_back(MBB);
146+
append_range(Order, ExitBlocks);
148147

149148
// Then add the loop body.
150149
Search(ML.getHeader());

llvm/lib/Target/ARM/ARMParallelDSP.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ namespace {
202202
public:
203203
WidenedLoad(SmallVectorImpl<LoadInst*> &Lds, LoadInst *Wide)
204204
: NewLd(Wide) {
205-
for (auto *I : Lds)
206-
Loads.push_back(I);
205+
append_range(Loads, Lds);
207206
}
208207
LoadInst *getLoad() {
209208
return NewLd;

llvm/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,7 @@ HexagonTargetLowering::getInt(unsigned IntId, MVT ResTy, ArrayRef<SDValue> Ops,
315315
const SDLoc &dl, SelectionDAG &DAG) const {
316316
SmallVector<SDValue,4> IntOps;
317317
IntOps.push_back(DAG.getConstant(IntId, dl, MVT::i32));
318-
for (const SDValue &Op : Ops)
319-
IntOps.push_back(Op);
318+
append_range(IntOps, Ops);
320319
return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, dl, ResTy, IntOps);
321320
}
322321

llvm/lib/Target/Hexagon/HexagonSplitDouble.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -574,12 +574,9 @@ void HexagonSplitDoubleRegs::collectIndRegs(LoopRegMap &IRM) {
574574

575575
LoopVector WorkQ;
576576

577-
for (auto I : *MLI)
578-
WorkQ.push_back(I);
579-
for (unsigned i = 0; i < WorkQ.size(); ++i) {
580-
for (auto I : *WorkQ[i])
581-
WorkQ.push_back(I);
582-
}
577+
append_range(WorkQ, *MLI);
578+
for (unsigned i = 0; i < WorkQ.size(); ++i)
579+
append_range(WorkQ, *WorkQ[i]);
583580

584581
USet Rs;
585582
for (unsigned i = 0, n = WorkQ.size(); i < n; ++i) {

llvm/lib/Target/Hexagon/RDFDeadCode.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,7 @@ bool DeadCodeElimination::erase(const SetVector<NodeId> &Nodes) {
195195
// If it's a code node, add all ref nodes from it.
196196
uint16_t Kind = BA.Addr->getKind();
197197
if (Kind == NodeAttrs::Stmt || Kind == NodeAttrs::Phi) {
198-
for (auto N : NodeAddr<CodeNode*>(BA).Addr->members(DFG))
199-
DRNs.push_back(N);
198+
append_range(DRNs, NodeAddr<CodeNode*>(BA).Addr->members(DFG));
200199
DINs.push_back(DFG.addr<InstrNode*>(I));
201200
} else {
202201
llvm_unreachable("Unexpected code node");

llvm/lib/Target/PowerPC/PPCCTRLoops.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,9 +148,7 @@ static bool verifyCTRBranch(MachineBasicBlock *MBB,
148148
return false;
149149
}
150150

151-
for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(),
152-
PIE = MBB->pred_end(); PI != PIE; ++PI)
153-
Preds.push_back(*PI);
151+
append_range(Preds, MBB->predecessors());
154152
}
155153

156154
do {

llvm/lib/Target/X86/X86PartialReduction.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,7 @@ static void collectLeaves(Value *Root, SmallVectorImpl<Instruction *> &Leaves) {
392392
break;
393393

394394
// Push incoming values to the worklist.
395-
for (Value *InV : PN->incoming_values())
396-
Worklist.push_back(InV);
395+
append_range(Worklist, PN->incoming_values());
397396

398397
continue;
399398
}
@@ -402,8 +401,7 @@ static void collectLeaves(Value *Root, SmallVectorImpl<Instruction *> &Leaves) {
402401
if (BO->getOpcode() == Instruction::Add) {
403402
// Simple case. Single use, just push its operands to the worklist.
404403
if (BO->hasNUses(BO == Root ? 2 : 1)) {
405-
for (Value *Op : BO->operands())
406-
Worklist.push_back(Op);
404+
append_range(Worklist, BO->operands());
407405
continue;
408406
}
409407

@@ -426,8 +424,7 @@ static void collectLeaves(Value *Root, SmallVectorImpl<Instruction *> &Leaves) {
426424
continue;
427425

428426
// The phi forms a loop with this Add, push its operands.
429-
for (Value *Op : BO->operands())
430-
Worklist.push_back(Op);
427+
append_range(Worklist, BO->operands());
431428
}
432429
}
433430
}

llvm/lib/Target/X86/X86WinEHState.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,8 +704,7 @@ void WinEHStatePass::addStateStores(Function &F, WinEHFuncInfo &FuncInfo) {
704704
// enqueue it's successors to see if we can infer their states.
705705
InitialStates.insert({BB, PredState});
706706
FinalStates.insert({BB, PredState});
707-
for (BasicBlock *SuccBB : successors(BB))
708-
Worklist.push_back(SuccBB);
707+
append_range(Worklist, successors(BB));
709708
}
710709

711710
// Try to hoist stores from successors.

0 commit comments

Comments
 (0)