[Mlir-commits] [flang] [mlir] [flang][mlir] Add llvm.ident metadata when compiling with flang (PR #102506)
Christian Ulmann
llvmlistbot at llvm.org
Fri Aug 9 02:07:26 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")
+ if (named.getNumOperands() == 1)
+ if (auto *md = dyn_cast<llvm::MDNode>(named.getOperand(0)))
+ if (auto *mdStr = dyn_cast<llvm::MDString>(md->getOperand(0)))
----------------
Dinistro wrote:
Nit: This will explode when the metadata is faulty. Given that this is metadata, I suggest to test that it has enough operands here as well.
https://github.com/llvm/llvm-project/pull/102506
More information about the Mlir-commits
mailing list