[flang-commits] [flang] [mlir] [flang][mlir] Add llvm.ident metadata when compiling with flang (PR #102506)

Christian Ulmann via flang-commits flang-commits at lists.llvm.org
Fri Aug 9 02:07:25 PDT 2024


================
@@ -518,6 +518,20 @@ LogicalResult ModuleImport::convertLinkerOptionsMetadata() {
   return success();
 }
 
+LogicalResult ModuleImport::convertIdentMetadata() {
+  for (const llvm::NamedMDNode &named : llvmModule->named_metadata()) {
+    // llvm.ident should have a single operand. That operand is itself an
+    // MDNode with a single string operand.
+    if (named.getName() == "llvm.ident")
----------------
Dinistro wrote:

Nit: Can you add a string accessor to the LLVM dialect class for this? See https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/LLVMIR/LLVMDialect.td#L32-L54 for similar things.

I suggest to use this accessor everywhere you are using the string right now.

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


More information about the flang-commits mailing list