[llvm-branch-commits] [llvm][IR] Extend BranchWeightMetadata to track provenance of weights (PR #86609)

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 22 09:11:05 PDT 2024


================
@@ -5196,7 +5198,11 @@ void SwitchInstProfUpdateWrapper::init() {
   if (!ProfileData)
     return;
 
-  if (ProfileData->getNumOperands() != SI.getNumSuccessors() + 1) {
+  // FIXME: This check belongs in ProfDataUtils. Its almost equivalent to
+  // getValidBranchWeightMDNode(), but the need to use llvm_unreachable
+  // makes them slightly different.
+  if (ProfileData->getNumOperands() !=
+      SI.getNumSuccessors() + getBranchWeightOffset(ProfileData)) {
----------------
ilovepi wrote:

Another good suggestion. Thank you.

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


More information about the llvm-branch-commits mailing list