[llvm] [Verifier] Allow too big unused sectioned global variables with local linkage (PR #212733)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 29 07:26:32 PDT 2026


================
@@ -812,10 +812,13 @@ void Verifier::visitGlobalVariable(const GlobalVariable &GV) {
         "Global @" + GV.getName() + " has illegal target extension type",
         GVType);
 
-  // Check that the the address space can hold all bits of the type, recognized
+  // Check that the address space can hold all bits of the type, recognized
   // by an access in the address space being able to reach all bytes of the
   // type.
+  // An exemption to this is sectioned global variables with local linkage
+  // and no uses. These are usually used for metadata.
   Check(!GVType->isSized() ||
+            (GV.use_empty() && GV.hasLocalLinkage() && GV.hasSection()) ||
----------------
antoniofrighetto wrote:

At least from CI failures, I think we may want materialized_use_empty() here instead. In ThinLTO, as functions are loaded lazily on demand, the global might still have uses in unloaded functions.

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


More information about the llvm-commits mailing list