[Mlir-commits] [mlir] [mlir] Add llvm.linker.options operation to the LLVM IR Dialect (PR #71720)

Christian Ulmann llvmlistbot at llvm.org
Thu Nov 9 09:06:52 PST 2023


================
@@ -487,6 +487,23 @@ void ModuleImport::addDebugIntrinsic(llvm::CallInst *intrinsic) {
   debugIntrinsics.insert(intrinsic);
 }
 
+LogicalResult ModuleImport::convertLinkerOptionsMetadata() {
+  for (const llvm::NamedMDNode &named : llvmModule->named_metadata()) {
+    if (named.getName() != "llvm.linker.options")
+      continue;
+    // llvm.linker.options operands are lists of strings.
+    for (const llvm::MDNode *md : named.operands()) {
+      SmallVector<StringRef> options;
+      for (const llvm::MDOperand &option : md->operands()) {
+        options.push_back(cast<llvm::MDString>(option)->getString());
+      }
----------------
Dinistro wrote:

```suggestion
      for (const llvm::MDOperand &option : md->operands())
        options.push_back(cast<llvm::MDString>(option)->getString());
```

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


More information about the Mlir-commits mailing list