@@ -114,7 +114,7 @@ void BalancedPartitioning::bisect(const FunctionNodeRange Nodes,
114114 unsigned RecDepth, unsigned RootBucket,
115115 unsigned Offset,
116116 std::optional<BPThreadPool> &TP) const {
117- unsigned NumNodes = std::distance (Nodes. begin (), Nodes. end () );
117+ unsigned NumNodes = llvm::size (Nodes);
118118 if (NumNodes <= 1 || RecDepth >= Config.SplitDepth ) {
119119 // We've reach the lowest level of the recursion tree. Fall back to the
120120 // original order and assign to buckets.
@@ -168,7 +168,7 @@ void BalancedPartitioning::runIterations(const FunctionNodeRange Nodes,
168168 unsigned LeftBucket,
169169 unsigned RightBucket,
170170 std::mt19937 &RNG) const {
171- unsigned NumNodes = std::distance (Nodes. begin (), Nodes. end () );
171+ unsigned NumNodes = llvm::size (Nodes);
172172 DenseMap<BPFunctionNode::UtilityNodeT, unsigned > UtilityNodeIndex;
173173 for (auto &N : Nodes)
174174 for (auto &UN : N.UtilityNodes )
@@ -303,7 +303,7 @@ bool BalancedPartitioning::moveFunctionNode(BPFunctionNode &N,
303303
304304void BalancedPartitioning::split (const FunctionNodeRange Nodes,
305305 unsigned StartBucket) const {
306- unsigned NumNodes = std::distance (Nodes. begin (), Nodes. end () );
306+ unsigned NumNodes = llvm::size (Nodes);
307307 auto NodesMid = Nodes.begin () + (NumNodes + 1 ) / 2 ;
308308
309309 llvm::sort (Nodes, [](auto &L, auto &R) {
0 commit comments