aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib
diff options
context:
space:
mode:
authorTeresa Johnson <tejohnson@google.com>2025-10-22 07:30:43 -0700
committerGitHub <noreply@github.com>2025-10-22 07:30:43 -0700
commiteb74d8e03cef0bb29bccf221f5ea565e47d7ab26 (patch)
treee323ac29b8982053569ed74bdb96a5d3c8689965 /llvm/lib
parent7ae7a5ad51f32118161ee0aaa13b11368aa5d29b (diff)
downloadllvm-eb74d8e03cef0bb29bccf221f5ea565e47d7ab26.zip
llvm-eb74d8e03cef0bb29bccf221f5ea565e47d7ab26.tar.gz
llvm-eb74d8e03cef0bb29bccf221f5ea565e47d7ab26.tar.bz2
[ThinLTO] Add index flag for internalization/promotion status (#164530)
Add an index-wide flag indicating whether index-based internalization and promotion have completed. This will be used in a follow on change.
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp2
-rw-r--r--llvm/lib/IR/ModuleSummaryIndex.cpp8
-rw-r--r--llvm/lib/LTO/LTO.cpp2
3 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index cf7efbfa..466dcb0 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -8603,7 +8603,7 @@ getEnableSplitLTOUnitAndUnifiedFlag(BitstreamCursor &Stream,
case bitc::FS_FLAGS: { // [flags]
uint64_t Flags = Record[0];
// Scan flags.
- assert(Flags <= 0x2ff && "Unexpected bits in flag");
+ assert(Flags <= 0x7ff && "Unexpected bits in flag");
bool EnableSplitLTOUnit = Flags & 0x8;
bool UnifiedLTO = Flags & 0x200;
diff --git a/llvm/lib/IR/ModuleSummaryIndex.cpp b/llvm/lib/IR/ModuleSummaryIndex.cpp
index a6353664..62fd62c 100644
--- a/llvm/lib/IR/ModuleSummaryIndex.cpp
+++ b/llvm/lib/IR/ModuleSummaryIndex.cpp
@@ -111,11 +111,13 @@ uint64_t ModuleSummaryIndex::getFlags() const {
Flags |= 0x100;
if (hasUnifiedLTO())
Flags |= 0x200;
+ if (withInternalizeAndPromote())
+ Flags |= 0x400;
return Flags;
}
void ModuleSummaryIndex::setFlags(uint64_t Flags) {
- assert(Flags <= 0x2ff && "Unexpected bits in flag");
+ assert(Flags <= 0x7ff && "Unexpected bits in flag");
// 1 bit: WithGlobalValueDeadStripping flag.
// Set on combined index only.
if (Flags & 0x1)
@@ -154,6 +156,10 @@ void ModuleSummaryIndex::setFlags(uint64_t Flags) {
// Set on combined index only.
if (Flags & 0x200)
setUnifiedLTO();
+ // 1 bit: WithInternalizeAndPromote flag.
+ // Set on combined index only.
+ if (Flags & 0x400)
+ setWithInternalizeAndPromote();
}
// Collect for the given module the list of function it defines
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index cbc0b1d..72ae064 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -551,9 +551,11 @@ void llvm::thinLTOInternalizeAndPromoteInIndex(
function_ref<bool(StringRef, ValueInfo)> isExported,
function_ref<bool(GlobalValue::GUID, const GlobalValueSummary *)>
isPrevailing) {
+ assert(!Index.withInternalizeAndPromote());
for (auto &I : Index)
thinLTOInternalizeAndPromoteGUID(Index.getValueInfo(I), isExported,
isPrevailing);
+ Index.setWithInternalizeAndPromote();
}
// Requires a destructor for std::vector<InputModule>.