aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2022-12-30 07:47:12 -0800
committerTeresa Johnson <tejohnson@google.com>2023-01-09 14:11:43 -0800
commitb1b9f1789e63843a602a30ef5b0a0bf22ef9e12f (patch)
tree5a9c177ae836bbe9cfc8e5a405b0ffa2369667ea /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent5b72d0e4f5eeb8f90c744cac8e0728cffeca61a9 (diff)
downloadllvm-b1b9f1789e63843a602a30ef5b0a0bf22ef9e12f.zip
llvm-b1b9f1789e63843a602a30ef5b0a0bf22ef9e12f.tar.gz
llvm-b1b9f1789e63843a602a30ef5b0a0bf22ef9e12f.tar.bz2
[MemProf] Fix combined index handling for locals
Since the linker does not resolve local symbols, we cannot look up whether they are prevailing. The prior check was blocking all locals from getting memprof summaries in the combined index. Modified the existing test case to contain a local. This necessitated some other fixes as the order of summary entries changed. Differential Revision: https://reviews.llvm.org/D140786
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 8fc69c1..cf5027d 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -7260,8 +7260,12 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
setSpecialRefs(Refs, NumRORefs, NumWORefs);
auto VIAndOriginalGUID = getValueInfoFromValueId(ValueID);
// In order to save memory, only record the memprof summaries if this is
- // the prevailing copy of a symbol.
- if (IsPrevailing && !IsPrevailing(std::get<2>(VIAndOriginalGUID))) {
+ // the prevailing copy of a symbol. The linker doesn't resolve local
+ // linkage values so don't check whether those are prevailing.
+ auto LT = (GlobalValue::LinkageTypes)Flags.Linkage;
+ if (IsPrevailing &&
+ !GlobalValue::isLocalLinkage(LT) &&
+ !IsPrevailing(std::get<2>(VIAndOriginalGUID))) {
PendingCallsites.clear();
PendingAllocs.clear();
}