Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions llvm/lib/CGData/StableFunctionMapRecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,14 +160,18 @@ void StableFunctionMapRecord::deserialize(const unsigned char *&Ptr,
for (unsigned I = 0; I < NumFuncs; ++I) {
auto Hash =
endian::readNext<stable_hash, endianness::little, unaligned>(Ptr);
auto FunctionNameId =
[[maybe_unused]] auto FunctionNameId =
endian::readNext<uint32_t, endianness::little, unaligned>(Ptr);
assert(FunctionMap->getNameForId(FunctionNameId) &&
"FunctionNameId out of range");
auto ModuleNameId =
[[maybe_unused]] auto ModuleNameId =
endian::readNext<uint32_t, endianness::little, unaligned>(Ptr);
assert(FunctionMap->getNameForId(ModuleNameId) &&
"ModuleNameId out of range");
// Only validate IDs if we've read the names
if (ReadStableFunctionMapNames) {
assert(FunctionMap->getNameForId(FunctionNameId) &&
"FunctionNameId out of range");
assert(FunctionMap->getNameForId(ModuleNameId) &&
"ModuleNameId out of range");
}

auto InstCount =
endian::readNext<uint32_t, endianness::little, unaligned>(Ptr);

Expand Down
14 changes: 14 additions & 0 deletions llvm/test/ThinLTO/AArch64/cgdata-merge-read.ll
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,20 @@
; RUN: llvm-objdump -d %tout-read.1 | FileCheck %s --check-prefix=THUNK1
; RUN: llvm-objdump -d %tout-read.2 | FileCheck %s --check-prefix=THUNK2

; It runs the same if we use -indexed-codegen-data-read-function-map-names=false.
; RUN: llvm-lto2 run -enable-global-merge-func=true \
; RUN: -indexed-codegen-data-read-function-map-names=false \
; RUN: -codegen-data-use-path=%tout.cgdata \
; RUN: %t-foo.bc %t-goo.bc -o %tout-read \
; RUN: -r %t-foo.bc,_f1,px \
; RUN: -r %t-goo.bc,_f2,px \
; RUN: -r %t-foo.bc,_g,l -r %t-foo.bc,_g1,l -r %t-foo.bc,_g2,l \
; RUN: -r %t-goo.bc,_g,l -r %t-goo.bc,_g1,l -r %t-goo.bc,_g2,l
; RUN: llvm-nm %tout-read.1 | FileCheck %s --check-prefix=READ1
; RUN: llvm-nm %tout-read.2 | FileCheck %s --check-prefix=READ2
; RUN: llvm-objdump -d %tout-read.1 | FileCheck %s --check-prefix=THUNK1
; RUN: llvm-objdump -d %tout-read.2 | FileCheck %s --check-prefix=THUNK2

; READ1: _f1.Tgm
; READ2: _f2.Tgm

Expand Down
Loading