Skip to content

Commit 799916a

Browse files
[llvm] Construct SmallVector with iterator ranges (NFC) (#136064)
1 parent ee17ca7 commit 799916a

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

llvm/lib/Analysis/VectorUtils.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1703,9 +1703,7 @@ void InterleaveGroup<InstT>::addMetadata(InstT *NewInst) const {
17031703
namespace llvm {
17041704
template <>
17051705
void InterleaveGroup<Instruction>::addMetadata(Instruction *NewInst) const {
1706-
SmallVector<Value *, 4> VL;
1707-
std::transform(Members.begin(), Members.end(), std::back_inserter(VL),
1708-
[](std::pair<int, Instruction *> p) { return p.second; });
1706+
SmallVector<Value *, 4> VL(make_second_range(Members));
17091707
propagateMetadata(NewInst, VL);
17101708
}
17111709
} // namespace llvm

llvm/lib/IR/Verifier.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,7 @@ static void forEachUser(const Value *User,
720720
if (!Visited.insert(User).second)
721721
return;
722722

723-
SmallVector<const Value *> WorkList;
724-
append_range(WorkList, User->materialized_users());
723+
SmallVector<const Value *> WorkList(User->materialized_users());
725724
while (!WorkList.empty()) {
726725
const Value *Cur = WorkList.pop_back_val();
727726
if (!Visited.insert(Cur).second)

llvm/lib/Transforms/IPO/ArgumentPromotion.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,9 +382,8 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
382382
// Cleanup the code from the dead instructions: GEPs and BitCasts in between
383383
// the original argument and its users: loads and stores. Retarget every
384384
// user to the new created alloca.
385-
SmallVector<Value *, 16> Worklist;
385+
SmallVector<Value *, 16> Worklist(Arg.users());
386386
SmallVector<Instruction *, 16> DeadInsts;
387-
append_range(Worklist, Arg.users());
388387
while (!Worklist.empty()) {
389388
Value *V = Worklist.pop_back_val();
390389
if (isa<GetElementPtrInst>(V)) {

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2500,9 +2500,8 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP,
25002500
return nullptr;
25012501

25022502
GEPNoWrapFlags NW = getMergedGEPNoWrapFlags(*Src, *cast<GEPOperator>(&GEP));
2503-
SmallVector<Value *> Indices;
2504-
append_range(Indices, drop_end(Src->indices(),
2505-
Src->getNumIndices() - NumVarIndices));
2503+
SmallVector<Value *> Indices(
2504+
drop_end(Src->indices(), Src->getNumIndices() - NumVarIndices));
25062505
for (const APInt &Idx : drop_begin(ConstIndices, !IsFirstType)) {
25072506
Indices.push_back(ConstantInt::get(GEP.getContext(), Idx));
25082507
// Even if the total offset is inbounds, we may end up representing it

0 commit comments

Comments
 (0)