[Mlir-commits] [mlir] 30199d1 - [mlir] Drop Optional::value() references from tblgen files
Benjamin Kramer
llvmlistbot at llvm.org
Mon Dec 19 13:57:49 PST 2022
Author: Benjamin Kramer
Date: 2022-12-19T22:50:19+01:00
New Revision: 30199d11d27460e8c96a81c493526c32dbea428d
URL: https://github.com/llvm/llvm-project/commit/30199d11d27460e8c96a81c493526c32dbea428d
DIFF: https://github.com/llvm/llvm-project/commit/30199d11d27460e8c96a81c493526c32dbea428d.diff
LOG: [mlir] Drop Optional::value() references from tblgen files
std::optional::value() has undesired exception checking semantics and is
unavailable in older Xcode (see _LIBCPP_AVAILABILITY_BAD_OPTIONAL_ACCESS).
The call sites block std::optional migration.
Added:
Modified:
mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
mlir/tools/mlir-tblgen/OpFormatGen.cpp
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
index 9ee69bdd15c4a..f7f168bf6915e 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMOps.td
@@ -179,7 +179,7 @@ def LLVM_FNegOp : LLVM_UnaryFloatArithmeticOp<
class MemoryOpWithAlignmentBase {
code setAlignmentCode = [{
if ($alignment.has_value()) {
- auto align = $alignment.value();
+ auto align = *$alignment;
if (align != 0)
inst->setAlignment(llvm::Align(align));
}
diff --git a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
index 525c60c4be1b5..3c618e325bdea 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
+++ b/mlir/include/mlir/Dialect/LLVMIR/NVVMOps.td
@@ -599,7 +599,7 @@ class MMA_SYNC_INTR {
# " \"" # op[2].ptx_elt_type # "\" == eltypeC && "
# " \"" # op[3].ptx_elt_type # "\" == eltypeD "
# " && (sat.has_value() ? " # sat # " == static_cast<int>(*sat) : true)"
- # !if(!ne(b1op, ""), " && (b1Op.has_value() ? MMAB1Op::" # b1op # " == b1Op.value() : true)", "") # ")\n"
+ # !if(!ne(b1op, ""), " && (b1Op.has_value() ? MMAB1Op::" # b1op # " == *b1Op : true)", "") # ")\n"
# " return " #
MMA_SYNC_NAME<layoutA, layoutB, b1op, sat, op[0], op[1], op[2], op[3]>.id # ";",
"") // if supported
@@ -1028,8 +1028,8 @@ def NVVM_MmaOp : NVVM_Op<"mma.sync", [AttrSizedOperandSegments]> {
$shape.getM(), $shape.getN(), $shape.getK(),
$b1Op, $intOverflowBehavior,
$layoutA, $layoutB,
- $multiplicandAPtxType.value(),
- $multiplicandBPtxType.value(),
+ *$multiplicandAPtxType,
+ *$multiplicandBPtxType,
op.accumPtxType(),
op.resultPtxType());
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index d90d1308527df..c88738f6aff98 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -1051,7 +1051,7 @@ static void genEnumAttrParser(const NamedAttribute *var, MethodBody &body,
{
llvm::raw_string_ostream os(attrBuilderStr);
os << tgfmt(enumAttr.getConstBuilderTemplate(), &attrTypeCtx,
- "attrOptional.value()");
+ "*attrOptional");
}
// Build a string containing the cases that can be formatted as a keyword.
More information about the Mlir-commits
mailing list