[llvm] [InstrProf] Adding utility weights to BalancedPartitioning (PR #72717)

Ellis Hoag via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 20 09:30:09 PST 2023


================
@@ -916,15 +916,15 @@ std::vector<BPFunctionNode> TemporalProfTraceTy::createBPFunctionNodes(
 
   int N = std::ceil(std::log2(LargestTraceSize));
 
-  // TODO: We need to use the Trace.Weight field to give more weight to more
+  // TODO: We may use the Trace.Weight field to give more weight to more
   // important utilities
   DenseMap<IDT, SmallVector<UtilityNodeT, 4>> FuncGroups;
-  for (size_t TraceIdx = 0; TraceIdx < Traces.size(); TraceIdx++) {
+  for (uint32_t TraceIdx = 0; TraceIdx < Traces.size(); TraceIdx++) {
     auto &Trace = Traces[TraceIdx].FunctionNameRefs;
     for (size_t Timestamp = 0; Timestamp < Trace.size(); Timestamp++) {
       for (int I = std::floor(std::log2(Timestamp + 1)); I < N; I++) {
         auto &FunctionId = Trace[Timestamp];
-        UtilityNodeT GroupId = TraceIdx * N + I;
+        UtilityNodeT GroupId = {TraceIdx * N + I};
----------------
ellishg wrote:

```suggestion
        UtilityNodeT GroupId(TraceIdx * N + I);
```
I think a more explicit initialization would be better

https://github.com/llvm/llvm-project/pull/72717


More information about the llvm-commits mailing list