Skip to content

Commit 500c4b6

Browse files
[llvm] Construct SmallVector with iterator ranges (NFC)
1 parent c5cf7d9 commit 500c4b6

File tree

7 files changed

+11
-14
lines changed

7 files changed

+11
-14
lines changed

llvm/lib/Analysis/ConstantFolding.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ Constant *SymbolicallyEvaluateGEP(const GEPOperator *GEP,
884884
InnermostGEP = GEP;
885885
InBounds &= GEP->isInBounds();
886886

887-
SmallVector<Value *, 4> NestedOps(GEP->op_begin() + 1, GEP->op_end());
887+
SmallVector<Value *, 4> NestedOps(llvm::drop_begin(GEP->operands()));
888888

889889
// Do not try the incorporate the sub-GEP if some index is not a number.
890890
bool AllConstantInt = true;

llvm/lib/CodeGen/Analysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,8 @@ bool llvm::returnTypeIsEligibleForTailCall(const Function *F,
712712
// The manipulations performed when we're looking through an insertvalue or
713713
// an extractvalue would happen at the front of the RetPath list, so since
714714
// we have to copy it anyway it's more efficient to create a reversed copy.
715-
SmallVector<unsigned, 4> TmpRetPath(RetPath.rbegin(), RetPath.rend());
716-
SmallVector<unsigned, 4> TmpCallPath(CallPath.rbegin(), CallPath.rend());
715+
SmallVector<unsigned, 4> TmpRetPath(llvm::reverse(RetPath));
716+
SmallVector<unsigned, 4> TmpCallPath(llvm::reverse(CallPath));
717717

718718
// Finally, we can check whether the value produced by the tail call at this
719719
// index is compatible with the value we return.

llvm/lib/CodeGen/AsmPrinter/PseudoProbePrinter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ void PseudoProbeHandler::emitPseudoProbe(uint64_t Guid, uint64_t Index,
4747
InlinedAt = InlinedAt->getInlinedAt();
4848
}
4949

50-
SmallVector<InlineSite, 8> InlineStack(ReversedInlineStack.rbegin(),
51-
ReversedInlineStack.rend());
50+
SmallVector<InlineSite, 8> InlineStack(llvm::reverse(ReversedInlineStack));
5251
Asm->OutStreamer->emitPseudoProbe(Guid, Index, Type, Attr, InlineStack);
5352
}

llvm/lib/IR/Operator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ bool GEPOperator::accumulateConstantOffset(
9090
assert(Offset.getBitWidth() ==
9191
DL.getIndexSizeInBits(getPointerAddressSpace()) &&
9292
"The offset bit width does not match DL specification.");
93-
SmallVector<const Value *> Index(value_op_begin() + 1, value_op_end());
93+
SmallVector<const Value *> Index(llvm::drop_begin(operand_values()));
9494
return GEPOperator::accumulateConstantOffset(getSourceElementType(), Index,
9595
DL, Offset, ExternalAnalysis);
9696
}

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26650,7 +26650,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
2665026650
X86CC = X86::COND_E;
2665126651
break;
2665226652
}
26653-
SmallVector<SDValue, 5> NewOps(Op->op_begin()+1, Op->op_end());
26653+
SmallVector<SDValue, 5> NewOps(llvm::drop_begin(Op->ops()));
2665426654
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::v16i8, MVT::i32);
2665526655
SDValue PCMP = DAG.getNode(Opcode, dl, VTs, NewOps).getValue(2);
2665626656
SDValue SetCC = getSETCC(X86CC, PCMP, dl, DAG);
@@ -26665,7 +26665,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
2666526665
else
2666626666
Opcode = X86ISD::PCMPESTR;
2666726667

26668-
SmallVector<SDValue, 5> NewOps(Op->op_begin()+1, Op->op_end());
26668+
SmallVector<SDValue, 5> NewOps(llvm::drop_begin(Op->ops()));
2666926669
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::v16i8, MVT::i32);
2667026670
return DAG.getNode(Opcode, dl, VTs, NewOps);
2667126671
}
@@ -26678,7 +26678,7 @@ SDValue X86TargetLowering::LowerINTRINSIC_WO_CHAIN(SDValue Op,
2667826678
else
2667926679
Opcode = X86ISD::PCMPESTR;
2668026680

26681-
SmallVector<SDValue, 5> NewOps(Op->op_begin()+1, Op->op_end());
26681+
SmallVector<SDValue, 5> NewOps(llvm::drop_begin(Op->ops()));
2668226682
SDVTList VTs = DAG.getVTList(MVT::i32, MVT::v16i8, MVT::i32);
2668326683
return DAG.getNode(Opcode, dl, VTs, NewOps).getValue(1);
2668426684
}

llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6011,7 +6011,7 @@ struct SCEVDbgValueBuilder {
60116011
// See setFinalExpression: prepend our opcodes on the start of any old
60126012
// expression opcodes.
60136013
assert(!DI.hasArgList());
6014-
llvm::SmallVector<uint64_t, 6> FinalExpr(Expr.begin() + 2, Expr.end());
6014+
llvm::SmallVector<uint64_t, 6> FinalExpr(llvm::drop_begin(Expr, 2));
60156015
auto *NewExpr =
60166016
DIExpression::prependOpcodes(OldExpr, FinalExpr, /*StackValue*/ true);
60176017
DI.setExpression(NewExpr);

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,7 @@ bool VPlanTransforms::sinkScalarOperands(VPlan &Plan) {
157157
// TODO: add ".cloned" suffix to name of Clone's VPValue.
158158

159159
Clone->insertBefore(SinkCandidate);
160-
SmallVector<VPUser *, 4> Users(SinkCandidate->user_begin(),
161-
SinkCandidate->user_end());
160+
SmallVector<VPUser *, 4> Users(SinkCandidate->users());
162161
for (auto *U : Users) {
163162
auto *UI = cast<VPRecipeBase>(U);
164163
if (UI->getParent() == SinkTo)
@@ -265,8 +264,7 @@ bool VPlanTransforms::mergeReplicateRegions(VPlan &Plan) {
265264
VPValue *PredInst1 =
266265
cast<VPPredInstPHIRecipe>(&Phi1ToMove)->getOperand(0);
267266
VPValue *Phi1ToMoveV = Phi1ToMove.getVPSingleValue();
268-
SmallVector<VPUser *> Users(Phi1ToMoveV->user_begin(),
269-
Phi1ToMoveV->user_end());
267+
SmallVector<VPUser *> Users(Phi1ToMoveV->users());
270268
for (VPUser *U : Users) {
271269
auto *UI = dyn_cast<VPRecipeBase>(U);
272270
if (!UI || UI->getParent() != Then2)

0 commit comments

Comments
 (0)