Skip to content

Commit 06cb7b1

Browse files
[Transforms] Use llvm::append_range (NFC) (#133650)
1 parent 2c73711 commit 06cb7b1

File tree

5 files changed

+10
-15
lines changed

5 files changed

+10
-15
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

+4-7
Original file line numberDiff line numberDiff line change
@@ -2286,8 +2286,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy,
22862286
std::vector<CallInfo> AllCalls;
22872287
AllCalls.reserve(Node->MatchingCalls.size() + 1);
22882288
AllCalls.push_back(Node->Call);
2289-
AllCalls.insert(AllCalls.end(), Node->MatchingCalls.begin(),
2290-
Node->MatchingCalls.end());
2289+
llvm::append_range(AllCalls, Node->MatchingCalls);
22912290

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

41234120
// Now walk through all of the clones of this callsite Node that we need,
41244121
// and determine the assignment to a corresponding clone of the current

llvm/lib/Transforms/Scalar/DFAJumpThreading.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ struct ThreadingPath {
399399
void push_back(BasicBlock *BB) { Path.push_back(BB); }
400400
void push_front(BasicBlock *BB) { Path.push_front(BB); }
401401
void appendExcludingFirst(const PathType &OtherPath) {
402-
Path.insert(Path.end(), OtherPath.begin() + 1, OtherPath.end());
402+
llvm::append_range(Path, llvm::drop_begin(OtherPath));
403403
}
404404

405405
void print(raw_ostream &OS) const {

llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp

+2-4
Original file line numberDiff line numberDiff line change
@@ -3641,14 +3641,12 @@ static bool unswitchLoop(Loop &L, DominatorTree &DT, LoopInfo &LI,
36413641
}
36423642
// Next check all loops nested within L.
36433643
SmallVector<const Loop *, 4> Worklist;
3644-
Worklist.insert(Worklist.end(), L->getSubLoops().begin(),
3645-
L->getSubLoops().end());
3644+
llvm::append_range(Worklist, L->getSubLoops());
36463645
while (!Worklist.empty()) {
36473646
auto *CurLoop = Worklist.pop_back_val();
36483647
if (!PSI->isColdBlock(CurLoop->getHeader(), BFI))
36493648
return false;
3650-
Worklist.insert(Worklist.end(), CurLoop->getSubLoops().begin(),
3651-
CurLoop->getSubLoops().end());
3649+
llvm::append_range(Worklist, CurLoop->getSubLoops());
36523650
}
36533651
return true;
36543652
};

llvm/lib/Transforms/Utils/CodeLayout.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ struct ChainEdge {
387387
void appendJump(JumpT *Jump) { Jumps.push_back(Jump); }
388388

389389
void moveJumps(ChainEdge *Other) {
390-
Jumps.insert(Jumps.end(), Other->Jumps.begin(), Other->Jumps.end());
390+
llvm::append_range(Jumps, Other->Jumps);
391391
Other->Jumps.clear();
392392
Other->Jumps.shrink_to_fit();
393393
}

llvm/lib/Transforms/Utils/SampleProfileInference.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -672,8 +672,8 @@ class FlowAdjuster {
672672

673673
// Concatenate the two paths
674674
std::vector<FlowJump *> Result;
675-
Result.insert(Result.end(), ForwardPath.begin(), ForwardPath.end());
676-
Result.insert(Result.end(), BackwardPath.begin(), BackwardPath.end());
675+
llvm::append_range(Result, ForwardPath);
676+
llvm::append_range(Result, BackwardPath);
677677
return Result;
678678
}
679679

0 commit comments

Comments
 (0)