[llvm] [IR] llvm.reloc.none intrinsic for no-op symbol references (PR #147427)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 22:04:21 PDT 2025


================
@@ -7757,6 +7757,20 @@ void SelectionDAGBuilder::visitIntrinsicCall(const CallInst &I,
     return;
   }
 
+  case Intrinsic::reloc_none: {
+    Metadata *MD = cast<MetadataAsValue>(I.getArgOperand(0))->getMetadata();
+    StringRef SymbolName = cast<MDString>(MD)->getString();
+    auto *M = const_cast<Module *>(I.getModule());
+    auto *RelocSymbol = cast<GlobalVariable>(
+        M->getOrInsertGlobal(SymbolName, StructType::create(M->getContext())));
----------------
arsenm wrote:

You don't need a GlobalValue reference to emit the symbol name in the end. You just need to encode this as an ExternalSymbol operand instead. The comment that it's "for debug info" doesn't really matter 

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


More information about the llvm-commits mailing list