[llvm] [llubi] Global variables with simple initializers and global-address constants (PR #200547)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 1 02:10:26 PDT 2026


================
@@ -521,15 +568,16 @@ MemoryObject::MemoryObject(uint64_t Addr, uint64_t Size, StringRef Name,
 
 IntrusiveRefCntPtr<MemoryObject>
 Context::allocate(uint64_t Size, uint64_t Align, StringRef Name, unsigned AS,
-                  MemInitKind InitKind, MemAllocKind AllocKind) {
+                  MemInitKind InitKind, MemAllocKind AllocKind,
+                  bool IsGlobalValue) {
   // Even if the memory object is zero-sized, it still occupies a byte to obtain
   // a unique address.
   uint64_t AllocateSize = std::max(Size, (uint64_t)1);
   if (MaxMem != 0 && SaturatingAdd(UsedMem, AllocateSize) >= MaxMem)
     return nullptr;
   uint64_t AlignedAddr = alignTo(AllocationBase, Align);
-  auto MemObj = makeIntrusiveRefCnt<MemoryObject>(AlignedAddr, Size, Name, AS,
-                                                  InitKind, AllocKind);
+  auto MemObj = makeIntrusiveRefCnt<MemoryObject>(
+      AlignedAddr, Size, Name, AS, InitKind, AllocKind, IsGlobalValue);
----------------
antoniofrighetto wrote:

Nit: `IsIRGlobalValue` here and above for consistency too?

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


More information about the llvm-commits mailing list