[llvm-branch-commits] [llvm] [InstrProf] Deduplicate VP values (PR #196649)
Aiden Grossman via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu May 14 06:39:15 PDT 2026
================
@@ -1359,14 +1359,43 @@ void annotateValueSite(Module &M, Instruction &Inst,
// Value Profile Data
uint32_t MDCount = MaxMDCount;
+ // 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.
+ // TODO(boomanaiden154): This fits more naturally in addValueData, but
+ // preserving the current behavior is necessary for some error handling
+ // paths. When that gets cleaned up, we should move this there.
+ // TODO(boomanaiden154): We are also deduplicating non-zero values.
+ // These are rare and should only come from corrupted profiles, so we
+ // just skip them. Remove this when they are fixed properly in
+ // llvm-profdata.
+ std::optional<uint64_t> ZeroCount = std::nullopt;
----------------
boomanaiden154 wrote:
Essentially `std::nullopt`. I've updated the code to drop the `std::optional`.
https://github.com/llvm/llvm-project/pull/196649
More information about the llvm-branch-commits
mailing list