[llvm] [CFI][ThinLTO] Remove the need for CFI calculating ThinLTO GUIDs (PR #201370)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 07:33:54 PDT 2026


https://github.com/mtrofin updated https://github.com/llvm/llvm-project/pull/201370

>From b01bade08d00fd711631f3eeda3c48f2b723ca4a Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Tue, 2 Jun 2026 17:33:00 -0700
Subject: [PATCH] decouple cfi from thinlto

---
 llvm/include/llvm/IR/ModuleSummaryIndex.h     | 100 ++++++++--------
 llvm/include/llvm/IR/ModuleSummaryIndexYAML.h |  37 ++++--
 llvm/lib/Bitcode/Reader/BitcodeReader.cpp     |  18 ++-
 llvm/lib/Bitcode/Writer/BitcodeWriter.cpp     |  21 +++-
 llvm/lib/LTO/LTO.cpp                          |  10 +-
 llvm/lib/Transforms/IPO/CrossDSOCFI.cpp       |   5 +-
 llvm/lib/Transforms/IPO/LowerTypeTests.cpp    |  21 ++--
 .../Transforms/IPO/ThinLTOBitcodeWriter.cpp   |   5 +
 .../test/ThinLTO/X86/cfi-icall-only-defuse.ll |   4 +-
 llvm/test/ThinLTO/X86/cfi-icall-thinlto.ll    | 107 ++++++++++++++++++
 llvm/test/ThinLTO/X86/cfi-icall.ll            |   4 +-
 .../Transforms/CrossDSOCFI/cfi_functions.ll   |   4 +-
 .../Inputs/blockaddr-import.yaml              |   9 +-
 .../Inputs/cfi-direct-call.yaml               |  16 +--
 .../Inputs/cfi-direct-call1.yaml              |  19 ++--
 .../LowerTypeTests/Inputs/import-alias.yaml   |  11 +-
 .../LowerTypeTests/Inputs/import-icall.yaml   |  28 +++--
 .../Inputs/import-thinlto-funcs.yaml          |   8 +-
 .../Transforms/LowerTypeTests/export-alias.ll |   8 +-
 .../LowerTypeTests/export-cross-dso-cfi.ll    |   6 +-
 .../Transforms/LowerTypeTests/export-icall.ll |  34 +++---
 .../LowerTypeTests/export-rename-local.ll     |   2 +-
 .../LowerTypeTests/export-symver.ll           |   4 +-
 .../test/Transforms/LowerTypeTests/pr37625.ll |   4 +-
 .../ThinLTOBitcodeWriter/function-alias.ll    |   8 +-
 25 files changed, 332 insertions(+), 161 deletions(-)
 create mode 100644 llvm/test/ThinLTO/X86/cfi-icall-thinlto.ll

diff --git a/llvm/include/llvm/IR/ModuleSummaryIndex.h b/llvm/include/llvm/IR/ModuleSummaryIndex.h
index e3905ac107539..d663ecd3b7ad8 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndex.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndex.h
@@ -18,11 +18,13 @@
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/STLExtras.h"
+#include "llvm/ADT/SetVector.h"
 #include "llvm/ADT/SmallString.h"
 #include "llvm/ADT/SmallVector.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSet.h"
 #include "llvm/ADT/iterator_range.h"
 #include "llvm/IR/ConstantRange.h"
 #include "llvm/IR/GlobalValue.h"
@@ -1317,72 +1319,74 @@ struct TypeIdSummary {
   std::map<uint64_t, WholeProgramDevirtResolution> WPDRes;
 };
 
+/// Encapsulate the names of CFI target functions. It interfaces with ThinLTO to
+/// determine efficiently which of the names need to be exported for a
+/// particular module.
 class CfiFunctionIndex {
-  DenseMap<GlobalValue::GUID, std::set<std::string, std::less<>>> Index;
-  using IndexIterator =
-      DenseMap<GlobalValue::GUID,
-               std::set<std::string, std::less<>>>::const_iterator;
-  using NestedIterator = std::set<std::string, std::less<>>::const_iterator;
+  // `Names` is the authoritative source of data. `ThinLTOToNamesIndex` is there
+  // just to efficiently retrieve which names in this index need exporting for
+  // a particular module index. We cannot guarantee the ThinLTO GUIDs are
+  // collision - free, so we associate a collection to a guid. Functions with
+  // the same name may have different GUIDs, too. So we index a list of names
+  // with the same GUID under that GUID key. We don't need the reverse because
+  // the queries from ThinLTO use GUIDs as key.
+  // Note that StringSet rehashing doesn't move keys, so we can safely store the
+  // StringRef value inserted in `Names` in ThinLTOToNamesIndex, and avoid
+  // copies.
+  // Design note: we could do away with Names and use ThinLTOToNamesIndex as
+  // index and data source, but opted against, for a small heap penalty, to
+  // avoid confusion wrt the role GUIDs play in this case: they are an artifact
+  // of the need to interface with ThinLTO, not otherwise necessary to CFI.
+  StringSet<> Names;
+
+  using InternalIndexGroup = SetVector<StringRef>;
+  DenseMap<GlobalValue::GUID, InternalIndexGroup> ThinLTOToNamesIndex;
+
+  using NestedIterator = InternalIndexGroup::const_iterator;
 
 public:
-  // Iterates keys of the DenseMap.
-  class GUIDIterator : public iterator_adaptor_base<GUIDIterator, IndexIterator,
-                                                    std::forward_iterator_tag,
-                                                    GlobalValue::GUID> {
-    using base = GUIDIterator::iterator_adaptor_base;
-
-  public:
-    GUIDIterator() = default;
-    explicit GUIDIterator(IndexIterator I) : base(I) {}
-
-    GlobalValue::GUID operator*() const { return this->wrapped()->first; }
-  };
-
   CfiFunctionIndex() = default;
-  template <typename It> CfiFunctionIndex(It B, It E) {
-    for (; B != E; ++B)
-      emplace(*B);
-  }
 
-  std::vector<StringRef> symbols() const {
-    std::vector<StringRef> Symbols;
-    for (auto &[GUID, Syms] : Index) {
-      (void)GUID;
-      llvm::append_range(Symbols, Syms);
-    }
+  /// API used for serialization, e.g. YAML.
+  std::vector<std::pair<StringRef, GlobalValue::GUID>> getSortedSymbols() const {
+    std::vector<std::pair<StringRef, GlobalValue::GUID>> Symbols;
+    for (auto &[GUID, Names] : ThinLTOToNamesIndex)
+    for (auto Name : Names)  
+      Symbols.emplace_back(Name, GUID);
+    llvm::sort(Symbols, std::less<>());
     return Symbols;
   }
 
-  GUIDIterator guid_begin() const { return GUIDIterator(Index.begin()); }
-  GUIDIterator guid_end() const { return GUIDIterator(Index.end()); }
-  iterator_range<GUIDIterator> guids() const {
-    return make_range(guid_begin(), guid_end());
+  /// get the set of GUIDs that should also be exported because they are the
+  /// GUIDs of the cfi functions encapsulated here.
+  auto getExportedThinLTOGUIDs() const {
+    return map_range(ThinLTOToNamesIndex, [](auto I) { return I.first; });
   }
 
-  iterator_range<NestedIterator> forGuid(GlobalValue::GUID GUID) const {
-    auto I = Index.find(GUID);
-    if (I == Index.end())
+  /// get the name(s) associated with a given ThinLTO GUID. This enables
+  /// efficient identification of the subset of names that should be included in
+  /// a module summary.
+  auto getMatchingNamesForThinLTOGUID(GlobalValue::GUID GUID) const {
+    auto I = ThinLTOToNamesIndex.find(GUID);
+    if (I == ThinLTOToNamesIndex.end())
       return make_range(NestedIterator{}, NestedIterator{});
     return make_range(I->second.begin(), I->second.end());
   }
 
-  template <typename... Args> void emplace(Args &&...A) {
-    StringRef S(std::forward<Args>(A)...);
-    GlobalValue::GUID GUID = GlobalValue::getGUIDAssumingExternalLinkage(
-        GlobalValue::dropLLVMManglingEscape(S));
-    Index[GUID].emplace(S);
+  /// Add the function name and the GUID that ThinLTO uses for it.
+  void addSymbolWithThinLTOGUID(StringRef Name, GlobalValue::GUID GUID) {
+    auto [Iter, _] = Names.insert(Name);
+    ThinLTOToNamesIndex[GUID].insert(Iter->first());
   }
 
-  size_t count(StringRef S) const {
-    GlobalValue::GUID GUID = GlobalValue::getGUIDAssumingExternalLinkage(
-        GlobalValue::dropLLVMManglingEscape(S));
-    auto I = Index.find(GUID);
-    if (I == Index.end())
-      return 0;
-    return I->second.count(S);
+  bool contains(StringRef Name) const {
+    return Names.find(Name) != Names.end();
   }
 
-  bool empty() const { return Index.empty(); }
+  bool empty() const {
+    assert(Names.empty() == ThinLTOToNamesIndex.empty());
+    return Names.empty();
+  }
 };
 
 /// 160 bits SHA1
diff --git a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
index d374e2eeb24a6..b7e7dc61f0026 100644
--- a/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
+++ b/llvm/include/llvm/IR/ModuleSummaryIndexYAML.h
@@ -268,7 +268,7 @@ template <> struct CustomMappingTraits<GlobalValueSummaryMapTy> {
           std::vector<uint64_t> Refs;
           Refs.reserve(FSum->refs().size());
           for (auto &VI : FSum->refs())
-            Refs.push_back(VI.getGUID());
+             Refs.push_back(VI.getGUID());
           GVSums.push_back(GlobalValueSummaryYaml{
               FSum->flags().Linkage, FSum->flags().Visibility,
               static_cast<bool>(FSum->flags().NotEligibleToImport),
@@ -327,6 +327,23 @@ template <> struct CustomMappingTraits<TypeIdSummaryMapTy> {
   }
 };
 
+template<> struct MappingTraits<std::pair<StringRef, GlobalValue::GUID>> {
+  static void mapping(IO &io, std::pair<StringRef, GlobalValue::GUID>& NameAndGUID) {
+    io.mapRequired("Name", NameAndGUID.first);
+    io.mapRequired("GUID", NameAndGUID.second);
+  }
+};
+
+using StringAndGUID = std::pair<llvm::StringRef, llvm::GlobalValue::GUID>;
+
+} // End yaml namespace
+} // End llvm namespace
+
+LLVM_YAML_IS_SEQUENCE_VECTOR(llvm::yaml::StringAndGUID)
+
+namespace llvm {
+namespace yaml {
+
 template <> struct MappingTraits<ModuleSummaryIndex> {
   static void mapping(IO &io, ModuleSummaryIndex& index) {
     io.mapOptional("GlobalValueMap", index.GlobalValueMap);
@@ -352,20 +369,20 @@ template <> struct MappingTraits<ModuleSummaryIndex> {
                    index.WithGlobalValueDeadStripping);
 
     if (io.outputting()) {
-      auto CfiFunctionDefs = index.CfiFunctionDefs.symbols();
-      llvm::sort(CfiFunctionDefs);
+      auto CfiFunctionDefs = index.CfiFunctionDefs.getSortedSymbols();
       io.mapOptional("CfiFunctionDefs", CfiFunctionDefs);
-      auto CfiFunctionDecls(index.CfiFunctionDecls.symbols());
-      llvm::sort(CfiFunctionDecls);
+      auto CfiFunctionDecls(index.CfiFunctionDecls.getSortedSymbols());
       io.mapOptional("CfiFunctionDecls", CfiFunctionDecls);
     } else {
-      std::vector<std::string> CfiFunctionDefs;
+      std::vector<std::pair<StringRef, GlobalValue::GUID>> CfiFunctionDefs;
       io.mapOptional("CfiFunctionDefs", CfiFunctionDefs);
-      index.CfiFunctionDefs = {CfiFunctionDefs.begin(), CfiFunctionDefs.end()};
-      std::vector<std::string> CfiFunctionDecls;
+      for (auto &[S, G]: CfiFunctionDefs)
+        index.CfiFunctionDefs.addSymbolWithThinLTOGUID(S, G);
+      std::vector<std::pair<StringRef, GlobalValue::GUID>> CfiFunctionDecls;
       io.mapOptional("CfiFunctionDecls", CfiFunctionDecls);
-      index.CfiFunctionDecls = {CfiFunctionDecls.begin(),
-                                CfiFunctionDecls.end()};
+      for (auto &[S, G]: CfiFunctionDecls)
+        index.CfiFunctionDecls.addSymbolWithThinLTOGUID(S, G);
+      ;
     }
   }
 };
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 3e863f4786e1a..dfe4280028513 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -8146,17 +8146,23 @@ Error ModuleSummaryIndexBitcodeReader::parseEntireSummary(unsigned ID) {
 
     case bitc::FS_CFI_FUNCTION_DEFS: {
       auto &CfiFunctionDefs = TheIndex.cfiFunctionDefs();
-      for (unsigned I = 0; I != Record.size(); I += 2)
-        CfiFunctionDefs.emplace(Strtab.data() + Record[I],
-                                static_cast<size_t>(Record[I + 1]));
+      for (unsigned I = 0; I != Record.size(); I += 3) {
+        GlobalValue::GUID ThinLTOGUID = Record[I];
+        StringRef Name(Strtab.data() + Record[I + 1],
+                       static_cast<size_t>(Record[I + 2]));
+        CfiFunctionDefs.addSymbolWithThinLTOGUID(Name, ThinLTOGUID);
+      }
       break;
     }
 
     case bitc::FS_CFI_FUNCTION_DECLS: {
       auto &CfiFunctionDecls = TheIndex.cfiFunctionDecls();
-      for (unsigned I = 0; I != Record.size(); I += 2)
-        CfiFunctionDecls.emplace(Strtab.data() + Record[I],
-                                 static_cast<size_t>(Record[I + 1]));
+      for (unsigned I = 0; I != Record.size(); I += 3) {
+        GlobalValue::GUID ThinLTOGUID = Record[I];
+        StringRef Name(Strtab.data() + Record[I + 1],
+                       static_cast<size_t>(Record[I + 2]));
+        CfiFunctionDecls.addSymbolWithThinLTOGUID(Name, ThinLTOGUID);
+      }
       break;
     }
 
diff --git a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
index f1ae4aa5fcf30..5323971cbd507 100644
--- a/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
+++ b/llvm/lib/Bitcode/Writer/BitcodeWriter.cpp
@@ -5316,21 +5316,30 @@ void IndexBitcodeWriter::writeCombinedGlobalValueSummary() {
         getReferencedTypeIds(FS, ReferencedTypeIds);
   }
 
-  SmallVector<StringRef, 4> Functions;
+  struct CfiFunctionRecord {
+    GlobalValue::GUID GUID = 0;
+    StringRef Name;
+    bool operator<(const CfiFunctionRecord &RHS) const {
+      return Name < RHS.Name;
+    }
+  };
+  SmallVector<CfiFunctionRecord, 4> Functions;
   auto EmitCfiFunctions = [&](const CfiFunctionIndex &CfiIndex,
                               bitc::GlobalValueSummarySymtabCodes Code) {
     if (CfiIndex.empty())
       return;
     for (GlobalValue::GUID GUID : DefOrUseGUIDs) {
-      auto Defs = CfiIndex.forGuid(GUID);
-      llvm::append_range(Functions, Defs);
+      auto Names = CfiIndex.getMatchingNamesForThinLTOGUID(GUID);
+      for (StringRef Name : Names)
+        Functions.push_back({GUID, Name});
     }
     if (Functions.empty())
       return;
     llvm::sort(Functions);
-    for (const auto &S : Functions) {
-      NameVals.push_back(StrtabBuilder.add(S));
-      NameVals.push_back(S.size());
+    for (const auto &Record : Functions) {
+      NameVals.push_back(Record.GUID);
+      NameVals.push_back(StrtabBuilder.add(Record.Name));
+      NameVals.push_back(Record.Name.size());
     }
     Stream.EmitRecord(Code, NameVals);
     NameVals.clear();
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 95faf3484c456..34e1b47d28495 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -1580,9 +1580,9 @@ class CGThinBackend : public ThinBackendProc {
                         OnWrite, ShouldEmitImportsFiles, ThinLTOParallelism),
         ShouldEmitIndexFiles(ShouldEmitIndexFiles) {
     auto &Defs = CombinedIndex.cfiFunctionDefs();
-    CfiFunctionDefs.insert_range(Defs.guids());
+    CfiFunctionDefs.insert_range(Defs.getExportedThinLTOGUIDs());
     auto &Decls = CombinedIndex.cfiFunctionDecls();
-    CfiFunctionDecls.insert_range(Decls.guids());
+    CfiFunctionDecls.insert_range(Decls.getExportedThinLTOGUIDs());
   }
 };
 
@@ -2156,9 +2156,11 @@ Error LTO::runThinLTO(AddStreamFn AddStream, FileCache Cache,
   // Any functions referenced by the jump table in the regular LTO object must
   // be exported.
   auto &Defs = ThinLTO.CombinedIndex.cfiFunctionDefs();
-  ExportedGUIDs.insert(Defs.guid_begin(), Defs.guid_end());
+  ExportedGUIDs.insert(Defs.getExportedThinLTOGUIDs().begin(),
+                       Defs.getExportedThinLTOGUIDs().end());
   auto &Decls = ThinLTO.CombinedIndex.cfiFunctionDecls();
-  ExportedGUIDs.insert(Decls.guid_begin(), Decls.guid_end());
+  ExportedGUIDs.insert(Decls.getExportedThinLTOGUIDs().begin(),
+                       Decls.getExportedThinLTOGUIDs().end());
 
   auto isExported = [&](StringRef ModuleIdentifier, ValueInfo VI) {
     const auto &ExportList = ExportLists.find(ModuleIdentifier);
diff --git a/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp b/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp
index 4c8ffeb198161..9e940015902b4 100644
--- a/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp
+++ b/llvm/lib/Transforms/IPO/CrossDSOCFI.cpp
@@ -73,8 +73,9 @@ void CrossDSOCFI::buildCFICheck(Module &M) {
   NamedMDNode *CfiFunctionsMD = M.getNamedMetadata("cfi.functions");
   if (CfiFunctionsMD) {
     for (auto *Func : CfiFunctionsMD->operands()) {
-      assert(Func->getNumOperands() >= 2);
-      for (unsigned I = 2; I < Func->getNumOperands(); ++I)
+      assert(Func->getNumOperands() >= 3);
+      assert(isa<ConstantAsMetadata>(Func->getOperand(2)));
+      for (unsigned I = 3; I < Func->getNumOperands(); ++I)
         if (ConstantInt *TypeId =
                 extractNumericTypeId(cast<MDNode>(Func->getOperand(I).get())))
           TypeIds.insert(TypeId->getZExtValue());
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index a57e0c59726a3..a519f78f2a1a7 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -1788,10 +1788,15 @@ void LowerTypeTestsModule::buildBitSetsFromFunctionsNative(
     }
 
     if (IsExported) {
+      // TODO: use F->getGUID() once #184065 is relanded.
+      GlobalValue::GUID GUID = GlobalValue::getGUIDAssumingExternalLinkage(
+          GlobalValue::dropLLVMManglingEscape(F->getName()));
       if (IsJumpTableCanonical)
-        ExportSummary->cfiFunctionDefs().emplace(F->getName());
+        ExportSummary->cfiFunctionDefs().addSymbolWithThinLTOGUID(F->getName(),
+                                                                  GUID);
       else
-        ExportSummary->cfiFunctionDecls().emplace(F->getName());
+        ExportSummary->cfiFunctionDecls().addSymbolWithThinLTOGUID(F->getName(),
+                                                                   GUID);
     }
 
     if (!IsJumpTableCanonical) {
@@ -2123,9 +2128,9 @@ bool LowerTypeTestsModule::lower() {
       // have the same name, but it's not the one we are looking for.
       if (F.hasLocalLinkage())
         continue;
-      if (ImportSummary->cfiFunctionDefs().count(F.getName()))
+      if (ImportSummary->cfiFunctionDefs().contains(F.getName()))
         Defs.push_back(&F);
-      else if (ImportSummary->cfiFunctionDecls().count(F.getName()))
+      else if (ImportSummary->cfiFunctionDecls().contains(F.getName()))
         Decls.push_back(&F);
     }
 
@@ -2208,8 +2213,10 @@ bool LowerTypeTestsModule::lower() {
                 ->getUniqueInteger()
                 .getZExtValue());
         const GlobalValue::GUID GUID =
-            GlobalValue::getGUIDAssumingExternalLinkage(
-                GlobalValue::dropLLVMManglingEscape(FunctionName));
+            cast<ConstantAsMetadata>(FuncMD->getOperand(2))
+                ->getValue()
+                ->getUniqueInteger()
+                .getZExtValue();
         // Do not emit jumptable entries for functions that are not-live and
         // have no live references (and are not exported with cross-DSO CFI.)
         if (!ExportSummary->isGUIDLive(GUID))
@@ -2280,7 +2287,7 @@ bool LowerTypeTestsModule::lower() {
             F->setLinkage(GlobalValue::ExternalWeakLinkage);
 
           F->eraseMetadata(LLVMContext::MD_type);
-          for (unsigned I = 2; I < FuncMD->getNumOperands(); ++I)
+          for (unsigned I = 3; I < FuncMD->getNumOperands(); ++I)
             F->addMetadata(LLVMContext::MD_type,
                            *cast<MDNode>(FuncMD->getOperand(I).get()));
         }
diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
index 3a6851eb60272..c14c9b869525d 100644
--- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -436,6 +436,11 @@ void splitAndWriteThinLTOBitcode(
       Linkage = CFL_Declaration;
     Elts.push_back(ConstantAsMetadata::get(
         llvm::ConstantInt::get(Type::getInt8Ty(Ctx), Linkage)));
+    // TODO: use F->getGUID() once #184065 is relanded.
+    GlobalValue::GUID GUID = GlobalValue::getGUIDAssumingExternalLinkage(
+        GlobalValue::dropLLVMManglingEscape(V->getName()));
+    Elts.push_back(ConstantAsMetadata::get(
+        llvm::ConstantInt::get(Type::getInt64Ty(Ctx), GUID)));
     append_range(Elts, Types);
     CfiFunctionMDs.push_back(MDTuple::get(Ctx, Elts));
   }
diff --git a/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll b/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
index 41fb17d574985..5a18fb92e7024 100644
--- a/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
+++ b/llvm/test/ThinLTO/X86/cfi-icall-only-defuse.ll
@@ -40,7 +40,7 @@ define i8 @f(i1 %i, ptr %p) {
 !0 = !{i64 0, !"t1"}
 
 ; FOOBAZ:   <GLOBALVAL_SUMMARY_BLOCK
-; FOOBAZ:     <CFI_FUNCTION_DEFS op0=0 op1=3 op2=3 op3=3 op4=6 op5=3/>
+; FOOBAZ:     <CFI_FUNCTION_DEFS op0={{.*}} op1=0 op2=3 op3={{.*}} op4=3 op5=3 op6={{.*}} op7=6 op8=3/>
 ; FOOBAZ:     <TYPE_ID op0=9 op1=2 op2=4 op3=7 op4=0 op5=0 op6=0 op7=0/>
 ; FOOBAZ:   </GLOBALVAL_SUMMARY_BLOCK>
 ; FOOBAZ:      <STRTAB_BLOCK
@@ -48,7 +48,7 @@ define i8 @f(i1 %i, ptr %p) {
 ; FOOBAZ-NEXT: </STRTAB_BLOCK>
 
 ; BARQUX:   <GLOBALVAL_SUMMARY_BLOCK
-; BARQUX:     <CFI_FUNCTION_DEFS op0=0 op1=3 op2=3 op3=3 op4=6 op5=3/>
+; BARQUX:     <CFI_FUNCTION_DEFS op0={{.*}} op1=0 op2=3 op3={{.*}} op4=3 op5=3 op6={{.*}} op7=6 op8=3/>
 ; BARQUX:     <TYPE_ID op0=9 op1=2 op2=4 op3=7 op4=0 op5=0 op6=0 op7=0/>
 ; BARQUX:   </GLOBALVAL_SUMMARY_BLOCK>
 ; BARQUX:      <STRTAB_BLOCK
diff --git a/llvm/test/ThinLTO/X86/cfi-icall-thinlto.ll b/llvm/test/ThinLTO/X86/cfi-icall-thinlto.ll
new file mode 100644
index 0000000000000..a497effd934e3
--- /dev/null
+++ b/llvm/test/ThinLTO/X86/cfi-icall-thinlto.ll
@@ -0,0 +1,107 @@
+; REQUIRES: x86-registered-target
+
+; RUN: rm -rf %t.dir && split-file %s %t.dir
+; RUN: opt -thinlto-bc -thinlto-split-lto-unit %t.dir/lib.ll -o %t.dir/lib.bc
+; RUN: opt -thinlto-bc -thinlto-split-lto-unit %t.dir/main.ll -o %t.dir/main.bc
+; RUN: llvm-lto2 run -save-temps %t.dir/lib.bc %t.dir/main.bc -o %t.dir/summary \
+; RUN:   -r=%t.dir/lib.bc,_Z11public_funcv,plx \
+; RUN:   -r=%t.dir/lib.bc,syscall, \
+; RUN:   -r=%t.dir/lib.bc,_ZN12_GLOBAL__N_113internal_funcEv.35df87b54cddf81e734207bfc5eea57a,pl \
+; RUN:   -r=%t.dir/main.bc,main,plx \
+; RUN:   -r=%t.dir/main.bc,_Z11public_funcv,l
+; RUN: llvm-dis %t.dir/summary.2.4.opt.bc -o - | FileCheck %s
+
+; RUN: llvm-lto2 run -thinlto-distributed-indexes %t.dir/lib.bc %t.dir/main.bc \
+; RUN:   -o %t.dir/distidx \
+; RUN:   -r=%t.dir/lib.bc,_Z11public_funcv,plx \
+; RUN:   -r=%t.dir/lib.bc,syscall, \
+; RUN:   -r=%t.dir/lib.bc,_ZN12_GLOBAL__N_113internal_funcEv.35df87b54cddf81e734207bfc5eea57a,pl \
+; RUN:   -r=%t.dir/main.bc,main,plx \
+; RUN:   -r=%t.dir/main.bc,_Z11public_funcv,l
+; RUN: llvm-bcanalyzer -dump %t.dir/lib.bc.thinlto.bc | FileCheck %s --check-prefix=DIST
+
+; Verify that the type test is NOT lowered to an unconditional trap,
+; and that the initialization path (which calls syscall) is preserved.
+; CHECK: define hidden noundef i32 @main()
+; CHECK:      %[[LOAD:.*]] = load i1, ptr @_ZN12_GLOBAL__N_18lazy_valE.1.llvm.{{.*}}
+; CHECK-NEXT: br i1 %[[LOAD]], label %{{.*}}, label %[[LABEL:.*]]
+; CHECK:      [[LABEL]]:
+; CHECK:      call i64 (i64, ...) @syscall(i64 noundef 186)
+; CHECK-NOT:  call void @llvm.ubsantrap
+
+; Verify that the distributed index records CFI_FUNCTION_DEFS with the
+; 3-field format [GUID, strtab_offset, name_length]. The promoted internal
+; function is listed with its stable pre-promotion GUID.
+; DIST:     <CFI_FUNCTION_DEFS op0={{[-0-9]+}} op1=0 op2=67/>
+; DIST: <STRTAB_BLOCK
+; DIST-NEXT:   <BLOB abbrevid=4/> blob data = '_ZN12_GLOBAL__N_113internal_funcEv.35df87b54cddf81e734207bfc5eea57a_ZTSFjvE'
+
+;--- lib.ll
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+
+ at _ZN12_GLOBAL__N_18lazy_valE.1 = internal unnamed_addr global i1 false, align 4
+
+define hidden void @_Z11public_funcv() local_unnamed_addr #0 !type !10 !type !11 {
+  %1 = load i1, ptr @_ZN12_GLOBAL__N_18lazy_valE.1, align 1
+  %2 = zext i1 %1 to i8
+  %3 = trunc nuw i8 %2 to i1
+  br i1 %3, label %9, label %4
+
+4:                                                ; preds = %0
+  %5 = tail call i1 @llvm.type.test(ptr nonnull @_ZN12_GLOBAL__N_113internal_funcEv, metadata !"_ZTSFjvE")
+  br i1 %5, label %7, label %6
+6:                                                ; preds = %4
+  tail call void @llvm.ubsantrap(i8 2) #5
+  unreachable
+
+7:                                                ; preds = %4
+  %8 = tail call i64 (i64, ...) @syscall(i64 noundef 186)
+  store i1 true, ptr @_ZN12_GLOBAL__N_18lazy_valE.1, align 1
+  br label %9
+
+9:                                                ; preds = %0, %7
+  ret void
+}
+
+define internal noundef i32 @_ZN12_GLOBAL__N_113internal_funcEv() #1 !type !15 !type !16 {
+  %1 = tail call i64 (i64, ...) @syscall(i64 noundef 186)
+  %2 = trunc i64 %1 to i32
+  ret i32 %2
+}
+
+declare i1 @llvm.type.test(ptr, metadata) #2
+declare void @llvm.ubsantrap(i8 immarg) #3
+declare i64 @syscall(i64 noundef, ...) #4
+
+attributes #0 = { alwaysinline mustprogress nounwind uwtable "target-cpu"="x86-64" }
+attributes #1 = { mustprogress nounwind uwtable "target-cpu"="x86-64" }
+attributes #2 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }
+attributes #3 = { cold noreturn nounwind memory(inaccessiblemem: write) }
+attributes #4 = { nounwind "target-cpu"="x86-64" }
+attributes #5 = { nomerge noreturn nounwind }
+
+!10 = !{i64 0, !"_ZTSFvvE"}
+!11 = !{i64 0, !"_ZTSFvvE.generalized"}
+!15 = !{i64 0, !"_ZTSFjvE"}
+!16 = !{i64 0, !"_ZTSFjvE.generalized"}
+
+;--- main.ll
+target triple = "x86_64-unknown-linux-gnu"
+target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
+
+define hidden noundef i32 @main() local_unnamed_addr #0 !type !8 !type !9 {
+  tail call void @_Z11public_funcv()
+  ret i32 0
+}
+
+declare !type !11 !type !12 dso_local void @_Z11public_funcv() local_unnamed_addr #1
+
+attributes #0 = { mustprogress norecurse uwtable "target-cpu"="x86-64" }
+attributes #1 = { "target-cpu"="x86-64" }
+
+!8 = !{i64 0, !"_ZTSFivE"}
+!9 = !{i64 0, !"_ZTSFivE.generalized"}
+!11 = !{i64 0, !"_ZTSFvvE"}
+!12 = !{i64 0, !"_ZTSFvvE.generalized"}
+
diff --git a/llvm/test/ThinLTO/X86/cfi-icall.ll b/llvm/test/ThinLTO/X86/cfi-icall.ll
index 76847e8300434..800c3fa2a60b2 100644
--- a/llvm/test/ThinLTO/X86/cfi-icall.ll
+++ b/llvm/test/ThinLTO/X86/cfi-icall.ll
@@ -27,8 +27,8 @@ declare i1 @llvm.type.test(ptr %ptr, metadata %type) nounwind readnone
 !0 = !{i64 0, !"typeid1"}
 
 ; COMBINED:   <GLOBALVAL_SUMMARY_BLOCK
-; COMBINED:     <CFI_FUNCTION_DEFS op0=0 op1=3/>
-; COMBINED:     <CFI_FUNCTION_DECLS op0=3 op1=3/>
+; COMBINED:     <CFI_FUNCTION_DEFS op0={{.*}} op1=0 op2=3/>
+; COMBINED:     <CFI_FUNCTION_DECLS op0={{.*}} op1=3 op2=3/>
 ; COMBINED:     <TYPE_ID op0=6 op1=7 op2=4 op3=7 op4=0 op5=0 op6=0 op7=0/>
 ; COMBINED:   </GLOBALVAL_SUMMARY_BLOCK>
 
diff --git a/llvm/test/Transforms/CrossDSOCFI/cfi_functions.ll b/llvm/test/Transforms/CrossDSOCFI/cfi_functions.ll
index 2cb36b83b2af0..0a4277ab37bef 100644
--- a/llvm/test/Transforms/CrossDSOCFI/cfi_functions.ll
+++ b/llvm/test/Transforms/CrossDSOCFI/cfi_functions.ll
@@ -13,8 +13,8 @@ target triple = "x86_64-unknown-linux-gnu"
 !cfi.functions = !{!0, !1}
 !llvm.module.flags = !{!6}
 
-!0 = !{!"f", i8 0, !2, !4}
-!1 = !{!"g", i8 1, !3, !5}
+!0 = !{!"f", i8 0, i64 14740650423002898831, !2, !4}
+!1 = !{!"g", i8 1, i64 13146401226427987378, !3, !5}
 !2 = !{i64 0, !"typeid1"}
 !3 = !{i64 0, !"typeid2"}
 !4 = !{i64 0, i64 1234}
diff --git a/llvm/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml b/llvm/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml
index de9385b945524..4cef1dfda0407 100644
--- a/llvm/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml
+++ b/llvm/test/Transforms/LowerTypeTests/Inputs/blockaddr-import.yaml
@@ -1,9 +1,8 @@
----
 TypeIdMap:
   typeid1:
     TTRes:
-      Kind:            AllOnes
+      Kind: AllOnes
 CfiFunctionDefs:
-  - m
-CfiFunctionDecls:
-...
+- Name: m
+  GUID: 2799708793537531759
+CfiFunctionDecls: null
diff --git a/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call.yaml b/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call.yaml
index 536d20a1129a7..32641ff59322a 100644
--- a/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call.yaml
+++ b/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call.yaml
@@ -1,12 +1,14 @@
----
 TypeIdMap:
   typeid1:
     TTRes:
-      Kind:            AllOnes
+      Kind: AllOnes
 CfiFunctionDefs:
-  - internal_default_def
-  - internal_hidden_def
-  - dsolocal_default_def
+- Name: internal_default_def
+  GUID: 2377677245844927262
+- Name: internal_hidden_def
+  GUID: 12222722662536945321
+- Name: dsolocal_default_def
+  GUID: 11010557671720506420
 CfiFunctionDecls:
-  - external_decl
-...
+- Name: external_decl
+  GUID: 2828901536631366483
diff --git a/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call1.yaml b/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call1.yaml
index 37f2e7e47a302..687c913106669 100644
--- a/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call1.yaml
+++ b/llvm/test/Transforms/LowerTypeTests/Inputs/cfi-direct-call1.yaml
@@ -1,13 +1,16 @@
----
 TypeIdMap:
   typeid1:
     TTRes:
-      Kind:            AllOnes
+      Kind: AllOnes
 CfiFunctionDefs:
-  - local_func1
-  - local_func2
-  - local_func3
+- Name: local_func1
+  GUID: 15974708163032388986
+- Name: local_func2
+  GUID: 10016086976061028907
+- Name: local_func3
+  GUID: 161148068062889559
 CfiFunctionDecls:
-  - extern_decl
-  - extern_weak
-...
+- Name: extern_decl
+  GUID: 15001569853432741044
+- Name: extern_weak
+  GUID: 9772975595203342681
diff --git a/llvm/test/Transforms/LowerTypeTests/Inputs/import-alias.yaml b/llvm/test/Transforms/LowerTypeTests/Inputs/import-alias.yaml
index a5943cb9fd6f7..b020892b5dd60 100644
--- a/llvm/test/Transforms/LowerTypeTests/Inputs/import-alias.yaml
+++ b/llvm/test/Transforms/LowerTypeTests/Inputs/import-alias.yaml
@@ -1,11 +1,10 @@
----
 TypeIdMap:
   typeid1:
     TTRes:
-      Kind:            AllOnes
-      SizeM1BitWidth:  7
+      Kind: AllOnes
+      SizeM1BitWidth: 7
 WithGlobalValueDeadStripping: false
 CfiFunctionDefs:
-  - f
-CfiFunctionDecls:
-...
+- Name: f
+  GUID: 14740650423002898831
+CfiFunctionDecls: null
diff --git a/llvm/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml b/llvm/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
index 558aa9aa73f25..b2d75423f613e 100644
--- a/llvm/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
+++ b/llvm/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
@@ -1,20 +1,24 @@
----
 TypeIdMap:
   typeid1:
     TTRes:
-      Kind:            AllOnes
-      SizeM1BitWidth:  7
+      Kind: AllOnes
+      SizeM1BitWidth: 7
   typeid2:
     TTRes:
-      Kind:            Single
-      SizeM1BitWidth:  0
+      Kind: Single
+      SizeM1BitWidth: 0
 WithGlobalValueDeadStripping: false
 CfiFunctionDefs:
-  - local_a
-  - local_b
-  - does_not_exist
+- Name: local_a
+  GUID: 16847745505082467832
+- Name: local_b
+  GUID: 3388953113786086079
+- Name: does_not_exist
+  GUID: 3974636296533007648
 CfiFunctionDecls:
-  - external
-  - external_weak
-  - local_decl
-...
+- Name: external
+  GUID: 5224464028922159466
+- Name: external_weak
+  GUID: 5227079976482001346
+- Name: local_decl
+  GUID: 6093141505335291027
diff --git a/llvm/test/Transforms/LowerTypeTests/Inputs/import-thinlto-funcs.yaml b/llvm/test/Transforms/LowerTypeTests/Inputs/import-thinlto-funcs.yaml
index 459d45032b0c4..62dd4ebe03515 100644
--- a/llvm/test/Transforms/LowerTypeTests/Inputs/import-thinlto-funcs.yaml
+++ b/llvm/test/Transforms/LowerTypeTests/Inputs/import-thinlto-funcs.yaml
@@ -1,5 +1,5 @@
----
 CfiFunctionDefs:
-  - f1
-  - f2
-...
+- Name: f1
+  GUID: 2072045998141807037
+- Name: f2
+  GUID: 8471399308421654326
diff --git a/llvm/test/Transforms/LowerTypeTests/export-alias.ll b/llvm/test/Transforms/LowerTypeTests/export-alias.ll
index 25d34833c82c3..ac9dd09a4cbd7 100644
--- a/llvm/test/Transforms/LowerTypeTests/export-alias.ll
+++ b/llvm/test/Transforms/LowerTypeTests/export-alias.ll
@@ -10,10 +10,10 @@ target triple = "x86_64-unknown-linux"
 !cfi.functions = !{!0, !2, !3, !4}
 !aliases = !{!5, !6}
 
-!0 = !{!"external_addrtaken", i8 0, !1}
+!0 = !{!"external_addrtaken", i8 0, i64 16594175687743574550, !1}
 !1 = !{i64 0, !"typeid1"}
-!2 = !{!"alias1", i8 0, !1}
-!3 = !{!"alias2", i8 0, !1}
-!4 = !{!"alias3", i8 0, !1}
+!2 = !{!"alias1", i8 0, i64 1062103744896965210, !1}
+!3 = !{!"alias2", i8 0, i64 2510616090736846890, !1}
+!4 = !{!"alias3", i8 0, i64 9766217518394409673, !1}
 !5 = !{!"external_addrtaken", !"alias1", !"alias2"}
 !6 = !{!"not_present", !"alias3"}
diff --git a/llvm/test/Transforms/LowerTypeTests/export-cross-dso-cfi.ll b/llvm/test/Transforms/LowerTypeTests/export-cross-dso-cfi.ll
index 68fff336e4138..dbc1e22fae029 100644
--- a/llvm/test/Transforms/LowerTypeTests/export-cross-dso-cfi.ll
+++ b/llvm/test/Transforms/LowerTypeTests/export-cross-dso-cfi.ll
@@ -31,9 +31,9 @@ define internal void @regularlto_internal() !type !1 !type !2 {
 !cfi.functions = !{!0, !3, !4}
 !llvm.module.flags = !{!5}
 
-!0 = !{!"external", i8 0, !1, !2}
+!0 = !{!"external", i8 0, i64 5224464028922159466, !1, !2}
 !1 = !{i64 0, !"typeid1"}
 !2 = !{i64 0, i64 1234}
-!3 = !{!"external2", i8 1, !1, !2}
-!4 = !{!"internal", i8 0, !1, !2}
+!3 = !{!"external2", i8 1, i64 16430208882958242304, !1, !2}
+!4 = !{!"internal", i8 0, i64 15859245615183425489, !1, !2}
 !5 = !{i32 4, !"Cross-DSO CFI", i32 1}
diff --git a/llvm/test/Transforms/LowerTypeTests/export-icall.ll b/llvm/test/Transforms/LowerTypeTests/export-icall.ll
index f8adb2d69910f..20dd4ddec19bd 100644
--- a/llvm/test/Transforms/LowerTypeTests/export-icall.ll
+++ b/llvm/test/Transforms/LowerTypeTests/export-icall.ll
@@ -19,19 +19,19 @@ define void @f3(i32 %x) !type !8 {
 !cfi.functions = !{!0, !1, !3, !9, !10, !4, !5, !6}
 
 ; declaration of @h with a different type is ignored
-!0 = !{!"h", i8 1, !7}
+!0 = !{!"h", i8 1, i64 8124147457056772133, !7}
 
 ; extern_weak declaration of @h with a different type is ignored as well
-!1 = !{!"h", i8 2, !8}
+!1 = !{!"h", i8 2, i64 8124147457056772133, !8}
 !2 = !{i64 0, !"typeid1"}
 
 ; definitions of @f and @f2 replace types on the IR declarations above
-!3 = !{!"f", i8 0, !2}
-!9 = !{!"f2", i8 0, !2}
-!10 = !{!"f3", i8 0, !2}
-!4 = !{!"external", i8 1, !2}
-!5 = !{!"external_weak", i8 2, !2}
-!6 = !{!"g", i8 0, !7}
+!3 = !{!"f", i8 0, i64 14740650423002898831, !2}
+!9 = !{!"f2", i8 0, i64 8471399308421654326, !2}
+!10 = !{!"f3", i8 0, i64 4197650231481825559, !2}
+!4 = !{!"external", i8 1, i64 5224464028922159466, !2}
+!5 = !{!"external_weak", i8 2, i64 5227079976482001346, !2}
+!6 = !{!"g", i8 0, i64 13146401226427987378, !7}
 !7 = !{i64 0, !"typeid2"}
 !8 = !{i64 0, !"typeid3"}
 
@@ -81,11 +81,17 @@ define void @f3(i32 %x) !type !8 {
 ; SUMMARY-NEXT:     WPDRes:
 
 ; SUMMARY:      CfiFunctionDefs:
-; SUMMARY-NEXT:   - f
-; SUMMARY-NEXT:   - f2
-; SUMMARY-NEXT:   - g
-; SUMMARY-NEXT:   - h
+; SUMMARY-NEXT:   - Name:            f
+; SUMMARY-NEXT:     GUID:            14740650423002898831
+; SUMMARY-NEXT:   - Name:            f2
+; SUMMARY-NEXT:     GUID:            8471399308421654326
+; SUMMARY-NEXT:   - Name:            g
+; SUMMARY-NEXT:     GUID:            13146401226427987378
+; SUMMARY-NEXT:   - Name:            h
+; SUMMARY-NEXT:     GUID:            8124147457056772133
 ; SUMMARY-NEXT: CfiFunctionDecls:
-; SUMMARY-NEXT:   - external
-; SUMMARY-NEXT:   - external_weak
+; SUMMARY-NEXT:   - Name:            external
+; SUMMARY-NEXT:     GUID:            5224464028922159466
+; SUMMARY-NEXT:   - Name:            external_weak
+; SUMMARY-NEXT:     GUID:            5227079976482001346
 ; SUMMARY-NEXT: ...
diff --git a/llvm/test/Transforms/LowerTypeTests/export-rename-local.ll b/llvm/test/Transforms/LowerTypeTests/export-rename-local.ll
index 0f88edff5e53e..4be15b8a45c06 100644
--- a/llvm/test/Transforms/LowerTypeTests/export-rename-local.ll
+++ b/llvm/test/Transforms/LowerTypeTests/export-rename-local.ll
@@ -11,5 +11,5 @@ define internal void @external_addrtaken() !type !1 {
 
 !cfi.functions = !{!0}
 
-!0 = !{!"external_addrtaken", i8 0, !1}
+!0 = !{!"external_addrtaken", i8 0, i64 16594175687743574550, !1}
 !1 = !{i64 0, !"typeid1"}
diff --git a/llvm/test/Transforms/LowerTypeTests/export-symver.ll b/llvm/test/Transforms/LowerTypeTests/export-symver.ll
index 39b85c6d9be2d..ea4594a359cc0 100644
--- a/llvm/test/Transforms/LowerTypeTests/export-symver.ll
+++ b/llvm/test/Transforms/LowerTypeTests/export-symver.ll
@@ -9,8 +9,8 @@ target triple = "x86_64-unknown-linux"
 !cfi.functions = !{!0, !1}
 !symvers = !{!3, !4}
 
-!0 = !{!"external_addrtaken", i8 0, !2}
-!1 = !{!"external_addrtaken2", i8 0, !2}
+!0 = !{!"external_addrtaken", i8 0, i64 16594175687743574550, !2}
+!1 = !{!"external_addrtaken2", i8 0, i64 2415377257478301385, !2}
 !2 = !{i64 0, !"typeid1"}
 !3 = !{!"external_addrtaken", !"alias1"}
 !4 = !{!"not_exported", !"alias2"}
diff --git a/llvm/test/Transforms/LowerTypeTests/pr37625.ll b/llvm/test/Transforms/LowerTypeTests/pr37625.ll
index cf52cdf0759a3..3f7fc8beaa964 100644
--- a/llvm/test/Transforms/LowerTypeTests/pr37625.ll
+++ b/llvm/test/Transforms/LowerTypeTests/pr37625.ll
@@ -7,8 +7,8 @@ declare !type !2 extern_weak void @external_addrtaken(i8)
 
 !cfi.functions = !{!0, !1}
 
-!0 = !{!"external_addrtaken", i8 2, !2}
-!1 = !{!"external_addrtaken", i8 0, !2}
+!0 = !{!"external_addrtaken", i8 2, i64 16594175687743574550, !2}
+!1 = !{!"external_addrtaken", i8 0, i64 16594175687743574550, !2}
 !2 = !{i64 0, !"typeid1"}
 
 ; CHECK-DAG: @external_addrtaken = alias [8 x i8], ptr @.cfi.jumptable
diff --git a/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll b/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
index 74693c1312b01..c90d2a4763067 100644
--- a/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
+++ b/llvm/test/Transforms/ThinLTOBitcodeWriter/function-alias.ll
@@ -10,11 +10,11 @@ define hidden void @Func() !type !0 {
 ; CHECK1: !cfi.functions = !{![[F1:[0-9]+]], ![[F2:[0-9]+]], ![[F3:[0-9]+]], ![[F4:[0-9]+]]}
 ; CHECK1: !aliases = !{![[A:[0-9]+]]}
 
-; CHECK1: ![[F1]] = !{!"Func", i8 0, ![[T:[0-9]+]]}
+; CHECK1: ![[F1]] = !{!"Func", i8 0, i64 {{-?[0-9]+}}, ![[T:[0-9]+]]}
 ; CHECK1: ![[T]] = !{i64 0, !"_ZTSFvvE"}
-; CHECK1: ![[F2]] = !{!"Alias", i8 0, ![[T]]}
-; CHECK1: ![[F3]] = !{!"Hidden_Alias", i8 0, ![[T]]}
-; CHECK1: ![[F4]] = !{!"Weak_Alias", i8 0, ![[T]]}
+; CHECK1: ![[F2]] = !{!"Alias", i8 0, i64 {{-?[0-9]+}}, ![[T]]}
+; CHECK1: ![[F3]] = !{!"Hidden_Alias", i8 0, i64 {{-?[0-9]+}}, ![[T]]}
+; CHECK1: ![[F4]] = !{!"Weak_Alias", i8 0, i64 {{-?[0-9]+}}, ![[T]]}
 ; 
 ; CHECK1: ![[A]] = !{!"Func", !"Alias", !"Hidden_Alias", !"Weak_Alias"}
 @Alias = hidden alias void (), ptr @Func



More information about the llvm-commits mailing list