@@ -1832,8 +1832,8 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::updateStackNodes() {
18321832 DenseMap<const FuncTy *, unsigned > FuncToIndex;
18331833 for (const auto &[Idx, CallCtxInfo] : enumerate(Calls))
18341834 FuncToIndex.insert ({CallCtxInfo.Func , Idx});
1835- std ::stable_sort (
1836- Calls. begin (), Calls. end () ,
1835+ llvm ::stable_sort (
1836+ Calls,
18371837 [&FuncToIndex](const CallContextInfo &A, const CallContextInfo &B) {
18381838 return A.StackIds .size () > B.StackIds .size () ||
18391839 (A.StackIds .size () == B.StackIds .size () &&
@@ -3688,27 +3688,27 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::identifyClones(
36883688 const unsigned AllocTypeCloningPriority[] = {/* None*/ 3 , /* NotCold*/ 4 ,
36893689 /* Cold*/ 1 ,
36903690 /* NotColdCold*/ 2 };
3691- std ::stable_sort (Node->CallerEdges . begin (), Node-> CallerEdges . end () ,
3692- [&](const std::shared_ptr<ContextEdge> &A,
3693- const std::shared_ptr<ContextEdge> &B) {
3694- // Nodes with non-empty context ids should be sorted before
3695- // those with empty context ids.
3696- if (A->ContextIds .empty ())
3697- // Either B ContextIds are non-empty (in which case we
3698- // should return false because B < A), or B ContextIds
3699- // are empty, in which case they are equal, and we should
3700- // maintain the original relative ordering.
3701- return false ;
3702- if (B->ContextIds .empty ())
3703- return true ;
3704-
3705- if (A->AllocTypes == B->AllocTypes )
3706- // Use the first context id for each edge as a
3707- // tie-breaker.
3708- return *A->ContextIds .begin () < *B->ContextIds .begin ();
3709- return AllocTypeCloningPriority[A->AllocTypes ] <
3710- AllocTypeCloningPriority[B->AllocTypes ];
3711- });
3691+ llvm ::stable_sort (Node->CallerEdges ,
3692+ [&](const std::shared_ptr<ContextEdge> &A,
3693+ const std::shared_ptr<ContextEdge> &B) {
3694+ // Nodes with non-empty context ids should be sorted
3695+ // before those with empty context ids.
3696+ if (A->ContextIds .empty ())
3697+ // Either B ContextIds are non-empty (in which case we
3698+ // should return false because B < A), or B ContextIds
3699+ // are empty, in which case they are equal, and we
3700+ // should maintain the original relative ordering.
3701+ return false ;
3702+ if (B->ContextIds .empty ())
3703+ return true ;
3704+
3705+ if (A->AllocTypes == B->AllocTypes )
3706+ // Use the first context id for each edge as a
3707+ // tie-breaker.
3708+ return *A->ContextIds .begin () < *B->ContextIds .begin ();
3709+ return AllocTypeCloningPriority[A->AllocTypes ] <
3710+ AllocTypeCloningPriority[B->AllocTypes ];
3711+ });
37123712
37133713 assert (Node->AllocTypes != (uint8_t )AllocationType::None);
37143714
@@ -4180,8 +4180,7 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::mergeNodeCalleeClones(
41804180 // their caller edge counts, putting the original non-clone node first in
41814181 // cases of a tie. This simplifies finding an existing node to use as the
41824182 // merge node.
4183- std::stable_sort (CalleeEdges.begin (), CalleeEdges.end (),
4184- CalleeCallerEdgeLessThan);
4183+ llvm::stable_sort (CalleeEdges, CalleeCallerEdgeLessThan);
41854184
41864185 // / Find other callers of the given set of callee edges that can
41874186 // / share the same callee merge node. See the comments at this method
0 commit comments