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

Paul Kirth via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Jun 6 12:04:31 PDT 2024


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

>From 7760282ed8dba340d6873d06ff4c18c6efc25b56 Mon Sep 17 00:00:00 2001
From: Paul Kirth <paulkirth at google.com>
Date: Thu, 6 Jun 2024 19:04:19 +0000
Subject: [PATCH] Add assert for metadata string value

Created using spr 1.3.4
---
 llvm/lib/IR/ProfDataUtils.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/llvm/lib/IR/ProfDataUtils.cpp b/llvm/lib/IR/ProfDataUtils.cpp
index f738d76937c24..af536d2110eac 100644
--- a/llvm/lib/IR/ProfDataUtils.cpp
+++ b/llvm/lib/IR/ProfDataUtils.cpp
@@ -133,6 +133,7 @@ bool hasBranchWeightProvenance(const MDNode *ProfileData) {
   // NOTE: if we ever have more types of branch weight provenance,
   // we need to check the string value is "expected". For now, we
   // supply a more generic API, and avoid the spurious comparisons.
+  assert(ProfDataName->getString() == "expected");
   return ProfDataName;
 }
 



More information about the llvm-branch-commits mailing list