[llvm] Construct SmallVector with iterator ranges (NFC)

This commit is contained in:
Kazu Hirata 2021-12-20 23:43:23 -08:00
parent c5cf7d910e
commit 500c4b68dc
7 changed files with 11 additions and 14 deletions

View File

@ -884,7 +884,7 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
InnermostGEP = GEP;
InBounds &= GEP->isInBounds();
SmallVector<Value *, 4> NestedOps(GEP->op_begin() + 1, GEP->op_end());
SmallVector<Value *, 4> NestedOps(llvm::drop_begin(GEP->operands()));
// Do not try the incorporate the sub-GEP if some index is not a number.
bool AllConstantInt = true;

View File

@ -712,8 +712,8 @@ bool llvm::returnTypeIsEligibleForTailCall(const Function *F,
// The manipulations performed when we're looking through an insertvalue or
// an extractvalue would happen at the front of the RetPath list, so since
// we have to copy it anyway it's more efficient to create a reversed copy.
SmallVector<unsigned, 4> TmpRetPath(RetPath.rbegin(), RetPath.rend());
SmallVector<unsigned, 4> TmpCallPath(CallPath.rbegin(), CallPath.rend());
SmallVector<unsigned, 4> TmpRetPath(llvm::reverse(RetPath));
SmallVector<unsigned, 4> TmpCallPath(llvm::reverse(CallPath));
// Finally, we can check whether the value produced by the tail call at this
// index is compatible with the value we return.

View File

@ -47,7 +47,6 @@ void PseudoProbeHandler::emitPseudoProbe(uint64_t Guid, uint64_t Index,
InlinedAt = InlinedAt->getInlinedAt();
}
SmallVector<InlineSite, 8> InlineStack(ReversedInlineStack.rbegin(),
ReversedInlineStack.rend());
SmallVector<InlineSite, 8> InlineStack(llvm::reverse(ReversedInlineStack));
Asm->OutStreamer->emitPseudoProbe(Guid, Index, Type, Attr, InlineStack);
}

View File

@ -90,7 +90,7 @@ bool GEPOperator::accumulateConstantOffset(
assert(Offset.getBitWidth() ==
DL.getIndexSizeInBits(getPointerAddressSpace()) &&
"The offset bit width does not match DL specification.");
SmallVector<const Value *> Index(value_op_begin() + 1, value_op_end());
SmallVector<const Value *> Index(llvm::drop_begin(operand_values()));
return GEPOperator::accumulateConstantOffset(getSourceElementType(), Index,
DL, Offset, ExternalAnalysis);
}

View File

@ -26650,7 +26650,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
X86CC = X86::COND_E;
break;
}
SmallVector<SDValue, 5> NewOps(Op->op_begin()+1, Op->op_end());
SmallVector<SDValue, 5> NewOps(llvm::drop_begin(Op->ops()));
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::v16i8, MVT::i32);
SDValue PCMP = DAG.getNode(Opcode, dl, VTs, NewOps).getValue(2);
SDValue SetCC = getSETCC(X86CC, PCMP, dl, DAG);
@ -26665,7 +26665,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
else
Opcode = X86ISD::PCMPESTR;
SmallVector<SDValue, 5> NewOps(Op->op_begin()+1, Op->op_end());
SmallVector<SDValue, 5> NewOps(llvm::drop_begin(Op->ops()));
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::v16i8, MVT::i32);
return DAG.getNode(Opcode, dl, VTs, NewOps);
}
@ -26678,7 +26678,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
else
Opcode = X86ISD::PCMPESTR;
SmallVector<SDValue, 5> NewOps(Op->op_begin()+1, Op->op_end());
SmallVector<SDValue, 5> NewOps(llvm::drop_begin(Op->ops()));
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::v16i8, MVT::i32);
return DAG.getNode(Opcode, dl, VTs, NewOps).getValue(1);
}

View File

@ -6011,7 +6011,7 @@ struct SCEVDbgValueBuilder {
// See setFinalExpression: prepend our opcodes on the start of any old
// expression opcodes.
assert(!DI.hasArgList());
llvm::SmallVector<uint64_t, 6> FinalExpr(Expr.begin() + 2, Expr.end());
llvm::SmallVector<uint64_t, 6> FinalExpr(llvm::drop_begin(Expr, 2));
auto *NewExpr =
DIExpression::prependOpcodes(OldExpr, FinalExpr, /*StackValue*/ true);
DI.setExpression(NewExpr);

View File

@ -157,8 +157,7 @@ bool VPlanTransforms::sinkScalarOperands(VPlan &Plan) {
// TODO: add ".cloned" suffix to name of Clone's VPValue.
Clone->insertBefore(SinkCandidate);
SmallVector<VPUser *, 4> Users(SinkCandidate->user_begin(),
SinkCandidate->user_end());
SmallVector<VPUser *, 4> Users(SinkCandidate->users());
for (auto *U : Users) {
auto *UI = cast<VPRecipeBase>(U);
if (UI->getParent() == SinkTo)
@ -265,8 +264,7 @@ bool VPlanTransforms::mergeReplicateRegions(VPlan &Plan) {
VPValue *PredInst1 =
cast<VPPredInstPHIRecipe>(&Phi1ToMove)->getOperand(0);
VPValue *Phi1ToMoveV = Phi1ToMove.getVPSingleValue();
SmallVector<VPUser *> Users(Phi1ToMoveV->user_begin(),
Phi1ToMoveV->user_end());
SmallVector<VPUser *> Users(Phi1ToMoveV->users());
for (VPUser *U : Users) {
auto *UI = dyn_cast<VPRecipeBase>(U);
if (!UI || UI->getParent() != Then2)