[llvm] [SimplifyCFG][PGO] Reuse existing `setBranchWeights` (PR #160629)

Alan Zhao via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 15:59:14 PDT 2025


================
@@ -84,10 +86,31 @@ static void extractFromBranchWeightMD(const MDNode *ProfileData,
   }
 }
 
+/// Push the weights right to fit in uint32_t.
+static SmallVector<uint32_t> fitWeights(ArrayRef<uint64_t> Weights) {
+  SmallVector<uint32_t> Ret;
+  Ret.reserve(Weights.size());
----------------
alanzhao1 wrote:

nit: `SmallVector` has a constructor that accepts a `size_t`, so this can be combined with the previous line.

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


More information about the llvm-commits mailing list