[llvm] [Instrumentation] Fix EdgeCounts vector size in SetBranchWeights (PR #99064)

Avi Kivity via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 14 09:49:24 PDT 2024


================
@@ -1623,10 +1623,12 @@ void PGOUseFunc::setBranchWeights() {
       continue;
 
     // We have a non-zero Branch BB.
-    unsigned Size = BBCountInfo.OutEdges.size();
-    SmallVector<uint64_t, 2> EdgeCounts(Size, 0);
+    unsigned OutEdgesCount = BBCountInfo.OutEdges.size();
+    unsigned SuccessorCount = BB.getTerminator()->getNumSuccessors();
+
+    SmallVector<uint64_t, 2> EdgeCounts(SuccessorCount, 0);
----------------
avikivity wrote:

This is probably too deep for me to learn much. I don't mind following instructions to deliver new data, I'm just concerned that with multi-hour round-trip times, this can take several weeks to resolve.

Anyway here's the -print-before=pgo-instr-use output: https://gist.github.com/avikivity/f47fa3765bd49e05524578d62c118cfd

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


More information about the llvm-commits mailing list