[llvm] [CGData] Skip reading Names into StableFunctionMap in non-assertion b… (PR #142095)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 6 02:30:02 PDT 2025


================
@@ -129,13 +137,25 @@ void StableFunctionMapRecord::deserialize(const unsigned char *&Ptr) {
   // Early exit if there is no name.
   if (NumNames == 0)
     return;
-  for (unsigned I = 0; I < NumNames; ++I) {
-    StringRef Name(reinterpret_cast<const char *>(Ptr));
-    Ptr += Name.size() + 1;
-    FunctionMap->getIdOrCreateForName(Name);
+  const auto NamesByteSize =
+      endian::readNext<uint64_t, endianness::little, unaligned>(Ptr);
+  if (ReadStableFunctionMapNames) {
+    const auto NamesOffset = reinterpret_cast<uintptr_t>(Ptr);
+    (void)NamesOffset; // Silence unused variable warning.
+    for (unsigned I = 0; I < NumNames; ++I) {
+      StringRef Name(reinterpret_cast<const char *>(Ptr));
----------------
nocchijiang wrote:

I think it is - at least the compiler I am working on thinks so
```
llvm/lib/CGData/StableFunctionMapRecord.cpp:144:17: error: no matching constructor for initialization of 'StringRef'
      StringRef Name(Ptr);
                ^    ~~~
```

https://github.com/llvm/llvm-project/pull/142095


More information about the llvm-commits mailing list