[Mlir-commits] [mlir] [mlir][drr] Fix getValueAndRangeUse for Optional operands (PR #138742)

Adrian Kuegel llvmlistbot at llvm.org
Mon May 12 23:45:56 PDT 2025


================
@@ -303,6 +303,12 @@ std::string SymbolInfoMap::SymbolInfo::getValueAndRangeUse(
   case Kind::Operand: {
     assert(index < 0);
     auto *operand = cast<NamedTypeConstraint *>(op->getArg(getArgIndex()));
+    if (operand->isOptional()) {
+      auto repl =
+          formatv(fmt, formatv("({0}.empty() ? Value() : *{0}.begin())", name));
----------------
akuegel wrote:

Could this use mlir::Value() instead of just Value()? Otherwise if the generated code is include from outside mlir namespace, it will not work. Or do we have a rule that all code that uses MLIR needs to be inside a mlir namespace?

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


More information about the Mlir-commits mailing list