Skip to content

[Transforms] Use llvm::append_range (NFC) #133650

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
11 changes: 4 additions & 7 deletions llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2286,8 +2286,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy,
std::vector<CallInfo> AllCalls;
AllCalls.reserve(Node->MatchingCalls.size() + 1);
AllCalls.push_back(Node->Call);
AllCalls.insert(AllCalls.end(), Node->MatchingCalls.begin(),
Node->MatchingCalls.end());
llvm::append_range(AllCalls, Node->MatchingCalls);

// First see if we can partition the calls by callee function, creating new
// nodes to host each set of calls calling the same callees. This is
Expand Down Expand Up @@ -2468,9 +2467,8 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::partitionCallsByCallee(
// The first call becomes the primary call for this caller node, and the
// rest go in the matching calls list.
Info->Node->setCall(Info->Calls.front());
Info->Node->MatchingCalls.insert(Info->Node->MatchingCalls.end(),
Info->Calls.begin() + 1,
Info->Calls.end());
llvm::append_range(Info->Node->MatchingCalls,
llvm::drop_begin(Info->Calls));
// Save the primary call to node correspondence so that we can update
// the NonAllocationCallToContextNodeMap, which is being iterated in the
// caller of this function.
Expand Down Expand Up @@ -4117,8 +4115,7 @@ bool CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::assignFunctions() {
// Ignore original Node if we moved all of its contexts to clones.
if (!Node->emptyContextIds())
ClonesWorklist.push_back(Node);
ClonesWorklist.insert(ClonesWorklist.end(), Node->Clones.begin(),
Node->Clones.end());
llvm::append_range(ClonesWorklist, Node->Clones);

// Now walk through all of the clones of this callsite Node that we need,
// and determine the assignment to a corresponding clone of the current
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ struct ThreadingPath {
void push_back(BasicBlock *BB) { Path.push_back(BB); }
void push_front(BasicBlock *BB) { Path.push_front(BB); }
void appendExcludingFirst(const PathType &OtherPath) {
Path.insert(Path.end(), OtherPath.begin() + 1, OtherPath.end());
llvm::append_range(Path, llvm::drop_begin(OtherPath));
}

void print(raw_ostream &OS) const {
Expand Down
6 changes: 2 additions & 4 deletions llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3641,14 +3641,12 @@ static bool unswitchLoop(Loop &L, DominatorTree &DT, LoopInfo &LI,
}
// Next check all loops nested within L.
SmallVector<const Loop *, 4> Worklist;
Worklist.insert(Worklist.end(), L->getSubLoops().begin(),
L->getSubLoops().end());
llvm::append_range(Worklist, L->getSubLoops());
while (!Worklist.empty()) {
auto *CurLoop = Worklist.pop_back_val();
if (!PSI->isColdBlock(CurLoop->getHeader(), BFI))
return false;
Worklist.insert(Worklist.end(), CurLoop->getSubLoops().begin(),
CurLoop->getSubLoops().end());
llvm::append_range(Worklist, CurLoop->getSubLoops());
}
return true;
};
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Transforms/Utils/CodeLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ struct ChainEdge {
void appendJump(JumpT *Jump) { Jumps.push_back(Jump); }

void moveJumps(ChainEdge *Other) {
Jumps.insert(Jumps.end(), Other->Jumps.begin(), Other->Jumps.end());
llvm::append_range(Jumps, Other->Jumps);
Other->Jumps.clear();
Other->Jumps.shrink_to_fit();
}
Expand Down
4 changes: 2 additions & 2 deletions llvm/lib/Transforms/Utils/SampleProfileInference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,8 @@ class FlowAdjuster {

// Concatenate the two paths
std::vector<FlowJump *> Result;
Result.insert(Result.end(), ForwardPath.begin(), ForwardPath.end());
Result.insert(Result.end(), BackwardPath.begin(), BackwardPath.end());
llvm::append_range(Result, ForwardPath);
llvm::append_range(Result, BackwardPath);
return Result;
}

Expand Down
Loading