[clang] [lld] [llvm] [ThinLTO] Reduce the number of renaming due to promotions (PR #178587)

Teresa Johnson via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 13 08:45:15 PST 2026


================
@@ -1178,9 +1178,12 @@ static GlobalValueSummary::GVFlags getDecodedGVSummaryFlags(uint64_t RawFlags,
   bool Live = (RawFlags & 0x2) || Version < 3;
   bool Local = (RawFlags & 0x4);
   bool AutoHide = (RawFlags & 0x8);
+  // RenameOnPromotion should be true. The value may be adjusted at thinLTO.
+  bool RenameOnPromotion = true;
----------------
teresajohnson wrote:

I just noticed this, which means it will not work for distributed ThinLTO, which is what we use internally. In that mode, the LTO backends (which is where the IR is mutated including applying the promotion and renaming) are in separate clang processes, via the combined index which is serialized out in sharded bitcode files for each backend process. You'll want to include this flag in the BitcodeWriter.cpp in getEncodedGVSummaryFlags, then read it out here. You can add testing of this in your new test. See third_party/llvm/llvm-project/llvm/test/ThinLTO/X86/writeonly-with-refs.ll as one example, where it is first tested with in-process ThinLTO, and then by distributed ThinLTO.

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


More information about the cfe-commits mailing list