[PATCH] D158680: RFC: Interpet {branch_weights 1, 0} as likely/unlikely

Mircea Trofin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 24 09:55:07 PDT 2023


mtrofin added inline comments.


================
Comment at: llvm/include/llvm/Analysis/BranchProbabilityInfo.h:144
+  static uint32_t getLikelyBranchWeight();
+  static void normalizeLikelyWeights(SmallVectorImpl<uint32_t>& Weights);
+
----------------
docstring for `normalizeLikelyWeights`? that's the new thing, right - the other one just moved from `ProfDataUtils.h`?


================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:393
+  // Check if all but one entry are zero.
+  bool HadNonZeroWeight = false;
+  for (uint32_t W : Weights) {
----------------
What's `HadNonZeroWeight` gonna do after this loop?


================
Comment at: llvm/lib/Analysis/BranchProbabilityInfo.cpp:1369
 }
+
----------------
nit: spurious


================
Comment at: llvm/test/Transforms/SampleProfile/profile-inference.ll:215
 ; CHECK:  edge b6 -> b8 probability is 0x80000000 / 0x80000000 = 100.00%
-; CHECK2: - b6: float = {{.*}}, int = {{.*}}, count = 0
+; CHECK2: - b6: float = {{.*}}, int = {{.*}}, count = 3
 
----------------
this caught my eye - how did count = 0 get to count = 3?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D158680/new/

https://reviews.llvm.org/D158680



More information about the llvm-commits mailing list