continue;
}
- for (User *UU : U->users())
- Stack.push_back(UU);
+ append_range(Stack, U->users());
}
}
SmallVector<SDValue, 26> Ops;
if (BaseOpcode->Store || BaseOpcode->Atomic)
Ops.push_back(VData); // vdata
- if (UseNSA) {
- for (const SDValue &Addr : VAddrs)
- Ops.push_back(Addr);
- } else {
+ if (UseNSA)
+ append_range(Ops, VAddrs);
+ else
Ops.push_back(VAddr);
- }
Ops.push_back(Op.getOperand(ArgOffset + Intr->RsrcIndex));
if (BaseOpcode->Sampler)
Ops.push_back(Op.getOperand(ArgOffset + Intr->SampIndex));
}
}
- if (Divergent && PDT.dominates(&DefBlock, MBB)) {
- for (MachineBasicBlock *Succ : MBB->successors())
- Stack.push_back(Succ);
- }
+ if (Divergent && PDT.dominates(&DefBlock, MBB))
+ append_range(Stack, MBB->successors());
}
while (!Stack.empty()) {
continue;
ReachableOrdered.push_back(MBB);
- for (MachineBasicBlock *Succ : MBB->successors())
- Stack.push_back(Succ);
+ append_range(Stack, MBB->successors());
}
for (MachineBasicBlock *MBB : ReachableOrdered) {
while (!Worklist.empty()) {
auto *U = Worklist.pop_back_val();
if (isa<ConstantExpr>(U)) {
- for (auto *UU : U->users())
- Worklist.push_back(UU);
+ append_range(Worklist, U->users());
continue;
}
SmallVector<Value *, 6> Ops;
Ops.push_back(Builder.CreateBitCast(BaseAddr, Int8Ptr));
- for (auto S : Shuffles)
- Ops.push_back(S);
+ append_range(Ops, Shuffles);
Ops.push_back(Builder.getInt32(SI->getAlignment()));
Builder.CreateCall(VstNFunc, Ops);
} else {
SmallVector<Value *, 6> Ops;
Ops.push_back(Builder.CreateBitCast(BaseAddr, EltPtrTy));
- for (auto S : Shuffles)
- Ops.push_back(S);
+ append_range(Ops, Shuffles);
for (unsigned F = 0; F < Factor; F++) {
Ops.push_back(Builder.getInt32(F));
Builder.CreateCall(VstNFunc, Ops);
// Insert exit blocks.
SmallVector<MachineBasicBlock*, 2> ExitBlocks;
ML.getExitBlocks(ExitBlocks);
- for (auto *MBB : ExitBlocks)
- Order.push_back(MBB);
+ append_range(Order, ExitBlocks);
// Then add the loop body.
Search(ML.getHeader());
public:
WidenedLoad(SmallVectorImpl<LoadInst*> &Lds, LoadInst *Wide)
: NewLd(Wide) {
- for (auto *I : Lds)
- Loads.push_back(I);
+ append_range(Loads, Lds);
}
LoadInst *getLoad() {
return NewLd;
const SDLoc &dl, SelectionDAG &DAG) const {
SmallVector<SDValue,4> IntOps;
IntOps.push_back(DAG.getConstant(IntId, dl, MVT::i32));
- for (const SDValue &Op : Ops)
- IntOps.push_back(Op);
+ append_range(IntOps, Ops);
return DAG.getNode(ISD::INTRINSIC_WO_CHAIN, dl, ResTy, IntOps);
}
LoopVector WorkQ;
- for (auto I : *MLI)
- WorkQ.push_back(I);
- for (unsigned i = 0; i < WorkQ.size(); ++i) {
- for (auto I : *WorkQ[i])
- WorkQ.push_back(I);
- }
+ append_range(WorkQ, *MLI);
+ for (unsigned i = 0; i < WorkQ.size(); ++i)
+ append_range(WorkQ, *WorkQ[i]);
USet Rs;
for (unsigned i = 0, n = WorkQ.size(); i < n; ++i) {
// If it's a code node, add all ref nodes from it.
uint16_t Kind = BA.Addr->getKind();
if (Kind == NodeAttrs::Stmt || Kind == NodeAttrs::Phi) {
- for (auto N : NodeAddr<CodeNode*>(BA).Addr->members(DFG))
- DRNs.push_back(N);
+ append_range(DRNs, NodeAddr<CodeNode*>(BA).Addr->members(DFG));
DINs.push_back(DFG.addr<InstrNode*>(I));
} else {
llvm_unreachable("Unexpected code node");
return false;
}
- for (MachineBasicBlock::pred_iterator PI = MBB->pred_begin(),
- PIE = MBB->pred_end(); PI != PIE; ++PI)
- Preds.push_back(*PI);
+ append_range(Preds, MBB->predecessors());
}
do {
break;
// Push incoming values to the worklist.
- for (Value *InV : PN->incoming_values())
- Worklist.push_back(InV);
+ append_range(Worklist, PN->incoming_values());
continue;
}
if (BO->getOpcode() == Instruction::Add) {
// Simple case. Single use, just push its operands to the worklist.
if (BO->hasNUses(BO == Root ? 2 : 1)) {
- for (Value *Op : BO->operands())
- Worklist.push_back(Op);
+ append_range(Worklist, BO->operands());
continue;
}
continue;
// The phi forms a loop with this Add, push its operands.
- for (Value *Op : BO->operands())
- Worklist.push_back(Op);
+ append_range(Worklist, BO->operands());
}
}
}
// 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);
+ append_range(Worklist, successors(BB));
}
// Try to hoist stores from successors.