[Mlir-commits] [mlir] [MLIR][LLVM] Make subprogram flags optional (PR #86433)

Christian Ulmann llvmlistbot at llvm.org
Mon Mar 25 01:05:07 PDT 2024


================
@@ -179,21 +179,19 @@ DISubprogramAttr DebugImporter::translateImpl(llvm::DISubprogram *node) {
   mlir::DistinctAttr id;
   if (node->isDistinct())
     id = getOrCreateDistinctID(node);
-  std::optional<DISubprogramFlags> subprogramFlags =
-      symbolizeDISubprogramFlags(node->getSubprogram()->getSPFlags());
   // Return nullptr if the scope or type is invalid.
   DIScopeAttr scope = translate(node->getScope());
   if (node->getScope() && !scope)
     return nullptr;
   DISubroutineTypeAttr type = translate(node->getType());
   if (node->getType() && !type)
     return nullptr;
-  return DISubprogramAttr::get(context, id, translate(node->getUnit()), scope,
-                               getStringAttrOrNull(node->getRawName()),
-                               getStringAttrOrNull(node->getRawLinkageName()),
-                               translate(node->getFile()), node->getLine(),
-                               node->getScopeLine(), subprogramFlags.value(),
-                               type);
+  return DISubprogramAttr::get(
+      context, id, translate(node->getUnit()), scope,
+      getStringAttrOrNull(node->getRawName()),
+      getStringAttrOrNull(node->getRawLinkageName()),
+      translate(node->getFile()), node->getLine(), node->getScopeLine(),
+      *symbolizeDISubprogramFlags(node->getSubprogram()->getSPFlags()), type);
----------------
Dinistro wrote:

Maybe put an assert that this optional indeed holds a value.

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


More information about the Mlir-commits mailing list