Skip to content

Commit

Permalink
[Target] Construct SmallVector with iterator ranges (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jan 3, 2021
1 parent 985f899 commit 0e219b6
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion llvm/lib/Target/AMDGPU/AMDGPUInstCombineIntrinsic.cpp
Expand Up @@ -920,7 +920,7 @@ static Value *simplifyAMDGCNMemoryIntrinsicDemanded(InstCombiner &IC,
IC.Builder.SetInsertPoint(&II);

// Assume the arguments are unchanged and later override them, if needed.
SmallVector<Value *, 16> Args(II.arg_begin(), II.arg_end());
SmallVector<Value *, 16> Args(II.args());

if (DMaskIdx < 0) {
// Buffer case.
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/SIFixSGPRCopies.cpp
Expand Up @@ -364,8 +364,7 @@ bool searchPredecessors(const MachineBasicBlock *MBB,
return false;

DenseSet<const MachineBasicBlock *> Visited;
SmallVector<MachineBasicBlock *, 4> Worklist(MBB->pred_begin(),
MBB->pred_end());
SmallVector<MachineBasicBlock *, 4> Worklist(MBB->predecessors());

while (!Worklist.empty()) {
MachineBasicBlock *MBB = Worklist.pop_back_val();
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Target/AMDGPU/SIISelLowering.cpp
Expand Up @@ -6001,8 +6001,8 @@ SDValue SITargetLowering::lowerImage(SDValue Op,
unsigned IntrOpcode = Intr->BaseOpcode;
bool IsGFX10Plus = AMDGPU::isGFX10Plus(*Subtarget);

SmallVector<EVT, 3> ResultTypes(Op->value_begin(), Op->value_end());
SmallVector<EVT, 3> OrigResultTypes(Op->value_begin(), Op->value_end());
SmallVector<EVT, 3> ResultTypes(Op->values());
SmallVector<EVT, 3> OrigResultTypes(Op->values());
bool IsD16 = false;
bool IsG16 = false;
bool IsA16 = false;
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/AMDGPU/SILowerControlFlow.cpp
Expand Up @@ -181,8 +181,7 @@ char &llvm::SILowerControlFlowID = SILowerControlFlow::ID;
static bool hasKill(const MachineBasicBlock *Begin,
const MachineBasicBlock *End, const SIInstrInfo *TII) {
DenseSet<const MachineBasicBlock*> Visited;
SmallVector<MachineBasicBlock *, 4> Worklist(Begin->succ_begin(),
Begin->succ_end());
SmallVector<MachineBasicBlock *, 4> Worklist(Begin->successors());

while (!Worklist.empty()) {
MachineBasicBlock *MBB = Worklist.pop_back_val();
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/ARMISelLowering.cpp
Expand Up @@ -10401,8 +10401,7 @@ void ARMTargetLowering::EmitSjLjDispatchBlock(MachineInstr &MI,

// Remove the landing pad successor from the invoke block and replace it
// with the new dispatch block.
SmallVector<MachineBasicBlock*, 4> Successors(BB->succ_begin(),
BB->succ_end());
SmallVector<MachineBasicBlock*, 4> Successors(BB->successors());
while (!Successors.empty()) {
MachineBasicBlock *SMBB = Successors.pop_back_val();
if (SMBB->isEHPad()) {
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
Expand Up @@ -2000,8 +2000,7 @@ void ARMTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
return;
}

SmallVector<const Value*, 4> Operands(I.value_op_begin(),
I.value_op_end());
SmallVector<const Value*, 4> Operands(I.operand_values());
Cost +=
getUserCost(&I, Operands, TargetTransformInfo::TCK_SizeAndLatency);
}
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp
Expand Up @@ -98,8 +98,7 @@ static void eraseDeadBBsAndChildren(const Container &MBBs) {
MachineBasicBlock *MBB = WL.pop_back_val();
if (!MBB->pred_empty())
continue;
SmallVector<MachineBasicBlock *, 4> Succs(MBB->succ_begin(),
MBB->succ_end());
SmallVector<MachineBasicBlock *, 4> Succs(MBB->successors());
WL.append(MBB->succ_begin(), MBB->succ_end());
for (auto *Succ : Succs)
MBB->removeSuccessor(Succ);
Expand Down Expand Up @@ -220,8 +219,7 @@ bool WebAssemblyLateEHPrepare::removeUnnecessaryUnreachables(
// because throw itself is a terminator, and also delete successors if
// any.
MBB.erase(std::next(MI.getIterator()), MBB.end());
SmallVector<MachineBasicBlock *, 8> Succs(MBB.succ_begin(),
MBB.succ_end());
SmallVector<MachineBasicBlock *, 8> Succs(MBB.successors());
for (auto *Succ : Succs)
if (!Succ->isEHPad())
MBB.removeSuccessor(Succ);
Expand Down
Expand Up @@ -811,7 +811,7 @@ bool WebAssemblyLowerEmscriptenEHSjLj::runEHOnFunction(Function &F) {
} else {
// This can't throw, and we don't need this invoke, just replace it with a
// call+branch
SmallVector<Value *, 16> Args(II->arg_begin(), II->arg_end());
SmallVector<Value *, 16> Args(II->args());
CallInst *NewCall =
IRB.CreateCall(II->getFunctionType(), II->getCalledOperand(), Args);
NewCall->takeName(II);
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Target/XCore/XCoreLowerThreadLocal.cpp
Expand Up @@ -80,7 +80,7 @@ createReplacementInstr(ConstantExpr *CE, Instruction *Instr) {
unsigned OpCode = CE->getOpcode();
switch (OpCode) {
case Instruction::GetElementPtr: {
SmallVector<Value *,4> CEOpVec(CE->op_begin(), CE->op_end());
SmallVector<Value *, 4> CEOpVec(CE->operands());
ArrayRef<Value *> CEOps(CEOpVec);
return dyn_cast<Instruction>(Builder.CreateInBoundsGEP(
cast<GEPOperator>(CE)->getSourceElementType(), CEOps[0],
Expand Down Expand Up @@ -128,7 +128,7 @@ createReplacementInstr(ConstantExpr *CE, Instruction *Instr) {

static bool replaceConstantExprOp(ConstantExpr *CE, Pass *P) {
do {
SmallVector<WeakTrackingVH, 8> WUsers(CE->user_begin(), CE->user_end());
SmallVector<WeakTrackingVH, 8> WUsers(CE->users());
llvm::sort(WUsers);
WUsers.erase(std::unique(WUsers.begin(), WUsers.end()), WUsers.end());
while (!WUsers.empty())
Expand Down Expand Up @@ -201,7 +201,7 @@ bool XCoreLowerThreadLocal::lowerGlobal(GlobalVariable *GV) {
GV->isExternallyInitialized());

// Update uses.
SmallVector<User *, 16> Users(GV->user_begin(), GV->user_end());
SmallVector<User *, 16> Users(GV->users());
for (unsigned I = 0, E = Users.size(); I != E; ++I) {
User *U = Users[I];
Instruction *Inst = cast<Instruction>(U);
Expand Down

0 comments on commit 0e219b6

Please sign in to comment.