diff options
author | Aiden Grossman <agrossman154@yahoo.com> | 2024-01-19 11:34:00 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-19 11:34:00 -0800 |
commit | c067524852816c9f6a99ddbb888cd33b9c5a2042 (patch) | |
tree | 20abb861f91c6226d7cd059f92659bd6dd5b2d34 /llvm/lib/Object | |
parent | 76ffa8f63a817758d49c45297591e05760155044 (diff) | |
download | llvm-c067524852816c9f6a99ddbb888cd33b9c5a2042.zip llvm-c067524852816c9f6a99ddbb888cd33b9c5a2042.tar.gz llvm-c067524852816c9f6a99ddbb888cd33b9c5a2042.tar.bz2 |
[SHT_LLVM_BB_ADDR_MAP] Add assertion and clarify docstring (#77374)
This patch adds an assertion to readBBAddrMapImpl to confirm that
PGOAnalyses and BBAddrMaps are of the same size when PGO information is
requested (part of the API contract). This patch also updates the
docstring for readBBAddrMap to better clarify what is guaranteed.
Diffstat (limited to 'llvm/lib/Object')
-rw-r--r-- | llvm/lib/Object/ELFObjectFile.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/lib/Object/ELFObjectFile.cpp b/llvm/lib/Object/ELFObjectFile.cpp index ae21b81..28b96c3 100644 --- a/llvm/lib/Object/ELFObjectFile.cpp +++ b/llvm/lib/Object/ELFObjectFile.cpp @@ -830,6 +830,10 @@ Expected<std::vector<BBAddrMap>> static readBBAddrMapImpl( std::move(BBAddrMapOrErr->begin(), BBAddrMapOrErr->end(), std::back_inserter(BBAddrMaps)); } + if (PGOAnalyses) + assert(PGOAnalyses->size() == BBAddrMaps.size() && + "The same number of BBAddrMaps and PGOAnalysisMaps should be " + "returned when PGO information is requested"); return BBAddrMaps; } |