[llvm-branch-commits] [llvm] [InstrProf] Deduplicate VP values (PR #196649)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed May 13 21:46:21 PDT 2026


https://github.com/boomanaiden154 updated https://github.com/llvm/llvm-project/pull/196649

>From aa1e92c87136d749b274e98beefde43327eb7c36 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Fri, 8 May 2026 21:45:12 +0000
Subject: [PATCH] fix

Created using spr 1.3.7
---
 llvm/lib/ProfileData/InstrProf.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/llvm/lib/ProfileData/InstrProf.cpp b/llvm/lib/ProfileData/InstrProf.cpp
index f669f53589306..1c2e3a5e145e7 100644
--- a/llvm/lib/ProfileData/InstrProf.cpp
+++ b/llvm/lib/ProfileData/InstrProf.cpp
@@ -1049,6 +1049,10 @@ void InstrProfRecord::addValueData(uint32_t ValueKind, uint32_t Site,
                                    InstrProfSymtab *ValueMap) {
   // Remap values.
   std::vector<InstrProfValueData> RemappedVD;
+  // Zero values might occur multiple times (e.g., multiple functions that
+  // cannot be remapped). Deduplicate them to enforce the variant that
+  // values are unique, which allows passes to make some simplifying
+  // assumptions.
   std::optional<size_t> ZeroIndex = std::nullopt;
   RemappedVD.reserve(VData.size());
   for (const auto &V : VData) {



More information about the llvm-branch-commits mailing list