Skip to content

[llvm] Construct SmallVector with iterator ranges (NFC) #136064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions llvm/lib/Analysis/VectorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1703,9 +1703,7 @@ void InterleaveGroup<InstT>::addMetadata(InstT *NewInst) const {
namespace llvm {
template <>
void InterleaveGroup<Instruction>::addMetadata(Instruction *NewInst) const {
SmallVector<Value *, 4> VL;
std::transform(Members.begin(), Members.end(), std::back_inserter(VL),
[](std::pair<int, Instruction *> p) { return p.second; });
SmallVector<Value *, 4> VL(make_second_range(Members));
propagateMetadata(NewInst, VL);
}
} // namespace llvm
3 changes: 1 addition & 2 deletions llvm/lib/IR/Verifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,8 +720,7 @@ static void forEachUser(const Value *User,
if (!Visited.insert(User).second)
return;

SmallVector<const Value *> WorkList;
append_range(WorkList, User->materialized_users());
SmallVector<const Value *> WorkList(User->materialized_users());
while (!WorkList.empty()) {
const Value *Cur = WorkList.pop_back_val();
if (!Visited.insert(Cur).second)
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Transforms/IPO/ArgumentPromotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,8 @@ doPromotion(Function *F, FunctionAnalysisManager &FAM,
// Cleanup the code from the dead instructions: GEPs and BitCasts in between
// the original argument and its users: loads and stores. Retarget every
// user to the new created alloca.
SmallVector<Value *, 16> Worklist;
SmallVector<Value *, 16> Worklist(Arg.users());
SmallVector<Instruction *, 16> DeadInsts;
append_range(Worklist, Arg.users());
while (!Worklist.empty()) {
Value *V = Worklist.pop_back_val();
if (isa<GetElementPtrInst>(V)) {
Expand Down
5 changes: 2 additions & 3 deletions llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2500,9 +2500,8 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP,
return nullptr;

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