[Mlir-commits] [mlir] [mlir][LLVM] Preserve !associated and !absolute_symbol on llvm.mlir.global (PR #218839)

Tanishq Khurana llvmlistbot at llvm.org
Wed Aug 26 18:48:23 PDT 2026


================
@@ -1685,6 +1685,51 @@ LogicalResult ModuleImport::convertGlobal(llvm::GlobalVariable *globalVar) {
   if (globalVar->hasComdat())
     globalOp.setComdatAttr(comdatMapping.lookup(globalVar->getComdat()));
 
+  if (llvm::MDNode *associatedMD =
+          globalVar->getMetadata(llvm::LLVMContext::MD_associated)) {
+    if (associatedMD->getNumOperands() == 1) {
+      if (auto *valueAsMD = dyn_cast_or_null<llvm::ValueAsMetadata>(
----------------
ktanishqk wrote:

yup, agreed! i added `getMetadataOperandSymbolRef` so we reuse the existing symbol lookup

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


More information about the Mlir-commits mailing list