From 309d1400715a26eada18a5dab72f02c3c31227f6 Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Sun, 5 Oct 2025 20:13:04 -0400 Subject: [PATCH 1/3] [mlir] Simplify unreachable type switch cases. NFC. Use `DefaultUnreachable` from https://github.com/llvm/llvm-project/pull/161970. --- mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp | 2 +- .../Dialect/ArmSME/Transforms/OuterProductFusion.cpp | 4 ++-- mlir/lib/Dialect/GPU/IR/GPUDialect.cpp | 2 +- mlir/lib/Dialect/Linalg/Transforms/Loops.cpp | 2 +- .../Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp | 12 ++++++------ mlir/lib/Tools/PDLL/AST/NodePrinter.cpp | 4 ++-- mlir/lib/Tools/PDLL/AST/Nodes.cpp | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp b/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp index d57926ec5a1ca..39d4815dc73b7 100644 --- a/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp +++ b/mlir/lib/Conversion/PDLToPDLInterp/PredicateTree.cpp @@ -243,7 +243,7 @@ static void getTreePredicates(std::vector &predList, .Case([&](auto *pos) { getOperandTreePredicates(predList, val, builder, inputs, pos); }) - .Default([](auto *) { llvm_unreachable("unexpected position kind"); }); + .DefaultUnreachable("unexpected position kind"); } static void getAttributePredicates(pdl::AttributeOp op, diff --git a/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp b/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp index 9196d2ef79592..39e398b8ae6ae 100644 --- a/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp +++ b/mlir/lib/Dialect/ArmSME/Transforms/OuterProductFusion.cpp @@ -170,7 +170,7 @@ class OuterProductFusion2Way op2, op.getResultType(), lhs, rhs, lhsMask, rhsMask, op1.getAcc()); }) - .Default([&](auto) { llvm_unreachable("unexpected extend op!"); }); + .DefaultUnreachable("unexpected extend op!"); } else if (kind == arm_sme::CombiningKind::Sub) { TypeSwitch(extOp) .Case([&](auto) { @@ -188,7 +188,7 @@ class OuterProductFusion2Way op2, op.getResultType(), lhs, rhs, lhsMask, rhsMask, op1.getAcc()); }) - .Default([&](auto) { llvm_unreachable("unexpected extend op!"); }); + .DefaultUnreachable("unexpected extend op!"); } else { llvm_unreachable("unexpected arm_sme::CombiningKind!"); } diff --git a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp index c0f9132de3db4..19eba6beacd86 100644 --- a/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp +++ b/mlir/lib/Dialect/GPU/IR/GPUDialect.cpp @@ -375,7 +375,7 @@ void GPUDialect::printType(Type type, DialectAsmPrinter &os) const { os << shape.back() << 'x' << fragTy.getElementType(); os << ", \"" << fragTy.getOperand() << "\"" << '>'; }) - .Default([](Type) { llvm_unreachable("unexpected 'gpu' type kind"); }); + .DefaultUnreachable("unexpected 'gpu' type kind"); } static LogicalResult verifyKnownLaunchSizeAttr(Operation *op, diff --git a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp index 38f1a8b7247eb..42160a15bc755 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Loops.cpp @@ -192,7 +192,7 @@ static void replaceIndexOpsByInductionVariables(RewriterBase &rewriter, .Case([&](affine::AffineForOp affineForOp) { allIvs.push_back(affineForOp.getInductionVar()); }) - .Default([&](Operation *op) { assert(false && "unexpected op"); }); + .DefaultUnreachable("unexpected op"); } assert(linalgOp.getNumLoops() == allIvs.size() && "expected the number of loops and induction variables to match"); diff --git a/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp b/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp index 24da447ad7685..214410f78e51c 100644 --- a/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp +++ b/mlir/lib/Dialect/MemRef/Transforms/FoldMemRefAliasOps.cpp @@ -315,7 +315,7 @@ LogicalResult LoadOpOfSubViewOpFolder::matchAndRewrite( op, op.getType(), subViewOp.getSource(), sourceIndices, op.getTranspose(), op.getNumTiles()); }) - .Default([](Operation *) { llvm_unreachable("unexpected operation."); }); + .DefaultUnreachable("unexpected operation"); return success(); } @@ -367,7 +367,7 @@ LogicalResult LoadOpOfExpandShapeOpFolder::matchAndRewrite( op, op.getType(), expandShapeOp.getViewSource(), sourceIndices, op.getMask(), op.getPassThru()); }) - .Default([](Operation *) { llvm_unreachable("unexpected operation."); }); + .DefaultUnreachable("unexpected operation"); return success(); } @@ -415,7 +415,7 @@ LogicalResult LoadOpOfCollapseShapeOpFolder::matchAndRewrite( op, op.getType(), collapseShapeOp.getViewSource(), sourceIndices, op.getMask(), op.getPassThru()); }) - .Default([](Operation *) { llvm_unreachable("unexpected operation."); }); + .DefaultUnreachable("unexpected operation"); return success(); } @@ -482,7 +482,7 @@ LogicalResult StoreOpOfSubViewOpFolder::matchAndRewrite( op, op.getSrc(), subViewOp.getSource(), sourceIndices, op.getLeadDimension(), op.getTransposeAttr()); }) - .Default([](Operation *) { llvm_unreachable("unexpected operation."); }); + .DefaultUnreachable("unexpected operation"); return success(); } @@ -535,7 +535,7 @@ LogicalResult StoreOpOfExpandShapeOpFolder::matchAndRewrite( op, expandShapeOp.getViewSource(), sourceIndices, op.getMask(), op.getValueToStore()); }) - .Default([](Operation *) { llvm_unreachable("unexpected operation."); }); + .DefaultUnreachable("unexpected operation"); return success(); } @@ -584,7 +584,7 @@ LogicalResult StoreOpOfCollapseShapeOpFolder::matchAndRewrite( op, collapseShapeOp.getViewSource(), sourceIndices, op.getMask(), op.getValueToStore()); }) - .Default([](Operation *) { llvm_unreachable("unexpected operation."); }); + .DefaultUnreachable("unexpected operation"); return success(); } diff --git a/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp b/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp index e2c987ae1b37f..f49d3d048a579 100644 --- a/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp +++ b/mlir/lib/Tools/PDLL/AST/NodePrinter.cpp @@ -154,7 +154,7 @@ void NodePrinter::print(Type type) { }) .Case([&](TypeType) { os << "Type"; }) .Case([&](ValueType) { os << "Value"; }) - .Default([](Type) { llvm_unreachable("unknown AST type"); }); + .DefaultUnreachable("unknown AST type"); } void NodePrinter::print(const Node *node) { @@ -182,7 +182,7 @@ void NodePrinter::print(const Node *node) { const VariableDecl, const Module>([&](auto derivedNode) { this->printImpl(derivedNode); }) - .Default([](const Node *) { llvm_unreachable("unknown AST node"); }); + .DefaultUnreachable("unknown AST node"); elementIndentStack.pop_back(); } diff --git a/mlir/lib/Tools/PDLL/AST/Nodes.cpp b/mlir/lib/Tools/PDLL/AST/Nodes.cpp index 159ce6235662b..5aa09375bc79d 100644 --- a/mlir/lib/Tools/PDLL/AST/Nodes.cpp +++ b/mlir/lib/Tools/PDLL/AST/Nodes.cpp @@ -72,7 +72,7 @@ class NodeVisitor { const Module>( [&](auto derivedNode) { this->visitImpl(derivedNode); }) - .Default([](const Node *) { llvm_unreachable("unknown AST node"); }); + .DefaultUnreachable("unknown AST node"); } private: From 14372dcadaad387bdd149c0ead1110c8b7559c5f Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Sun, 5 Oct 2025 20:23:52 -0400 Subject: [PATCH 2/3] Add more cases --- mlir/lib/Conversion/XeVMToLLVM/XeVMToLLVM.cpp | 4 +--- mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp | 4 +--- mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp | 6 ++---- mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp | 4 +--- .../Dialect/Linalg/Transforms/NamedToElementwise.cpp | 5 +---- mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp | 5 +---- mlir/lib/Dialect/Linalg/Utils/Utils.cpp | 4 +--- mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp | 5 +---- mlir/lib/Dialect/Transform/IR/TransformOps.cpp | 10 ++-------- mlir/lib/Interfaces/DataLayoutInterfaces.cpp | 5 +---- mlir/lib/Rewrite/ByteCode.cpp | 8 ++------ .../Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp | 9 ++------- mlir/lib/Target/LLVMIR/TypeToLLVM.cpp | 4 +--- mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp | 5 +---- 14 files changed, 18 insertions(+), 60 deletions(-) diff --git a/mlir/lib/Conversion/XeVMToLLVM/XeVMToLLVM.cpp b/mlir/lib/Conversion/XeVMToLLVM/XeVMToLLVM.cpp index 0f90acf0d9c39..57877b859b7d4 100644 --- a/mlir/lib/Conversion/XeVMToLLVM/XeVMToLLVM.cpp +++ b/mlir/lib/Conversion/XeVMToLLVM/XeVMToLLVM.cpp @@ -68,9 +68,7 @@ std::string getTypeMangling(Type ty, bool isUnsigned = false) { llvm_unreachable("unhandled integer type"); } }) - .Default([](Type) -> std::string { - llvm_unreachable("unhandled type for mangling"); - }); + .DefaultUnreachable("unhandled type for mangling"); } std::string mangle(StringRef baseName, ArrayRef types, diff --git a/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp b/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp index 2561f6606067f..0a3ef7d5c9890 100644 --- a/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp +++ b/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp @@ -847,9 +847,7 @@ getThreadIdBuilder(std::optional transformOp, return GpuLaneIdBuilder(ctx, warpSize, useLinearMapping, *maybeMaskingAttr); }) - .Default([&](DeviceMappingAttrInterface) -> GpuIdBuilder { - llvm_unreachable("unknown mapping attribute"); - }); + .DefaultUnreachable("unknown mapping attribute"); return DiagnosedSilenceableFailure::success(); } diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp index ef3802758cc23..cee943d2d86c6 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp @@ -1096,10 +1096,8 @@ static Value memsetGetStored(MemsetIntr op, const MemorySlot &slot, Value intVal = buildMemsetValue(type.getWidth()); return LLVM::BitcastOp::create(builder, op.getLoc(), type, intVal); }) - .Default([](Type) -> Value { - llvm_unreachable( - "getStored should not be called on memset to unsupported type"); - }); + .DefaultUnreachable( + "getStored should not be called on memset to unsupported type"); } template diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp index 297640cdd49d0..705d07d3e6c42 100644 --- a/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp +++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMTypeSyntax.cpp @@ -45,9 +45,7 @@ static StringRef getTypeKeyword(Type type) { .Case([&](Type) { return "struct"; }) .Case([&](Type) { return "target"; }) .Case([&](Type) { return "x86_amx"; }) - .Default([](Type) -> StringRef { - llvm_unreachable("unexpected 'llvm' type kind"); - }); + .DefaultUnreachable("unexpected 'llvm' type kind"); } /// Prints a structure type. Keeps track of known struct names to handle self- diff --git a/mlir/lib/Dialect/Linalg/Transforms/NamedToElementwise.cpp b/mlir/lib/Dialect/Linalg/Transforms/NamedToElementwise.cpp index 00a076b6e9746..c9045566473cb 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/NamedToElementwise.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/NamedToElementwise.cpp @@ -48,10 +48,7 @@ ElementwiseKind getKind(Operation *op) { .Case([](SquareOp) { return ElementwiseKind::square; }) .Case([](TanhOp) { return ElementwiseKind::tanh; }) .Case([](ErfOp) { return ElementwiseKind::erf; }) - .Default([&](Operation *op) { - llvm_unreachable("unhandled case in named to elementwise"); - return ElementwiseKind::sub; - }); + .DefaultUnreachable("unhandled case in named to elementwise"); } template diff --git a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp index e9a8b253eea35..7863c2120fe18 100644 --- a/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp +++ b/mlir/lib/Dialect/Linalg/Transforms/Transforms.cpp @@ -1427,10 +1427,7 @@ FailureOr DownscaleSizeOneWindowed2DConvolution:: .Case([&](linalg::PoolingNchwMaxOp op) { return std::make_tuple(0, 1, 2, 3); }) - .Default([&](Operation *op) { - llvm_unreachable("unexpected conv2d/pool2d operation."); - return std::make_tuple(0, 0, 0, 0); - }); + .DefaultUnreachable("unexpected conv2d/pool2d operation."); // Only handle the case where at least one of the window dimensions is // of size 1. Other cases can rely on tiling to reduce to such cases. diff --git a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp index 3593b5348d268..24d3722cf5426 100644 --- a/mlir/lib/Dialect/Linalg/Utils/Utils.cpp +++ b/mlir/lib/Dialect/Linalg/Utils/Utils.cpp @@ -604,9 +604,7 @@ static Operation *materializeTiledShape(OpBuilder &builder, Location loc, builder, loc, valueToTile, sliceParams.offsets, sliceParams.sizes, sliceParams.strides); }) - .Default([](ShapedType) -> Operation * { - llvm_unreachable("Unexpected shaped type"); - }); + .DefaultUnreachable("Unexpected shaped type"); return sliceOp; } diff --git a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp index 5672942a18231..fd4cabbada96f 100644 --- a/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp +++ b/mlir/lib/Dialect/OpenMP/IR/OpenMPDialect.cpp @@ -3425,10 +3425,7 @@ void NewCliOp::getAsmResultNames(OpAsmSetValueNameFn setNameFn) { } llvm_unreachable("Unexpected generatee argument"); }) - .Default([&](Operation *op) { - assert(false && "TODO: Custom name for this operation"); - return "transformed"; - }); + .DefaultUnreachable("TODO: Custom name for this operation"); } setNameFn(result, cliName); diff --git a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp index 3385b2a38afc1..77e74cac0133c 100644 --- a/mlir/lib/Dialect/Transform/IR/TransformOps.cpp +++ b/mlir/lib/Dialect/Transform/IR/TransformOps.cpp @@ -2597,10 +2597,7 @@ transform::NumAssociationsOp::apply(transform::TransformRewriter &rewriter, .Case([&](TransformParamTypeInterface param) { return llvm::range_size(state.getParams(getHandle())); }) - .Default([](Type) { - llvm_unreachable("unknown kind of transform dialect type"); - return 0; - }); + .DefaultUnreachable("unknown kind of transform dialect type"); results.setParams(cast(getNum()), rewriter.getI64IntegerAttr(numAssociations)); return DiagnosedSilenceableFailure::success(); @@ -2657,10 +2654,7 @@ transform::SplitHandleOp::apply(transform::TransformRewriter &rewriter, .Case([&](auto x) { return llvm::range_size(state.getParams(getHandle())); }) - .Default([](auto x) { - llvm_unreachable("unknown transform dialect type interface"); - return -1; - }); + .DefaultUnreachable("unknown transform dialect type interface"); auto produceNumOpsError = [&]() { return emitSilenceableError() diff --git a/mlir/lib/Interfaces/DataLayoutInterfaces.cpp b/mlir/lib/Interfaces/DataLayoutInterfaces.cpp index 3b6330b6a6c58..782384999c70c 100644 --- a/mlir/lib/Interfaces/DataLayoutInterfaces.cpp +++ b/mlir/lib/Interfaces/DataLayoutInterfaces.cpp @@ -364,10 +364,7 @@ static DataLayoutSpecInterface getSpec(Operation *operation) { return llvm::TypeSwitch(operation) .Case( [&](auto op) { return op.getDataLayoutSpec(); }) - .Default([](Operation *) { - llvm_unreachable("expected an op with data layout spec"); - return DataLayoutSpecInterface(); - }); + .DefaultUnreachable("expected an op with data layout spec"); } static TargetSystemSpecInterface getTargetSystemSpec(Operation *operation) { diff --git a/mlir/lib/Rewrite/ByteCode.cpp b/mlir/lib/Rewrite/ByteCode.cpp index 5cbea5d2c6cee..33fbd2a9579f0 100644 --- a/mlir/lib/Rewrite/ByteCode.cpp +++ b/mlir/lib/Rewrite/ByteCode.cpp @@ -764,9 +764,7 @@ void Generator::generate(Operation *op, ByteCodeWriter &writer) { pdl_interp::SwitchOperandCountOp, pdl_interp::SwitchOperationNameOp, pdl_interp::SwitchResultCountOp>( [&](auto interpOp) { this->generate(interpOp, writer); }) - .Default([](Operation *) { - llvm_unreachable("unknown `pdl_interp` operation"); - }); + .DefaultUnreachable("unknown `pdl_interp` operation"); } void Generator::generate(pdl_interp::ApplyConstraintOp op, @@ -913,9 +911,7 @@ void Generator::generate(pdl_interp::ExtractOp op, ByteCodeWriter &writer) { .Case([](pdl::OperationType) { return OpCode::ExtractOp; }) .Case([](pdl::ValueType) { return OpCode::ExtractValue; }) .Case([](pdl::TypeType) { return OpCode::ExtractType; }) - .Default([](Type) -> OpCode { - llvm_unreachable("unsupported element type"); - }); + .DefaultUnreachable("unsupported element type"); writer.append(opCode, op.getRange(), op.getIndex(), op.getResult()); } void Generator::generate(pdl_interp::FinalizeOp op, ByteCodeWriter &writer) { diff --git a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp index 9fcb02eb4be3d..1e2099d6cc1b2 100644 --- a/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp +++ b/mlir/lib/Target/LLVMIR/Dialect/OpenMP/OpenMPToLLVMIRTranslation.cpp @@ -4716,10 +4716,7 @@ convertOmpTargetData(Operation *op, llvm::IRBuilderBase &builder, info.HasNoWait = updateDataOp.getNowait(); return success(); }) - .Default([&](Operation *op) { - llvm_unreachable("unexpected operation"); - return failure(); - }); + .DefaultUnreachable("unexpected operation"); if (failed(result)) return failure(); @@ -5312,9 +5309,7 @@ extractHostEvalClauses(omp::TargetOp targetOp, Value &numThreads, (void)found; assert(found && "unsupported host_eval use"); }) - .Default([](Operation *) { - llvm_unreachable("unsupported host_eval use"); - }); + .DefaultUnreachable("unsupported host_eval use"); } } } diff --git a/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp b/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp index 4d204744450a8..807a94c61f0c8 100644 --- a/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp +++ b/mlir/lib/Target/LLVMIR/TypeToLLVM.cpp @@ -74,9 +74,7 @@ class TypeToLLVMIRTranslatorImpl { LLVM::LLVMPointerType, LLVM::LLVMStructType, VectorType, LLVM::LLVMTargetExtType, PtrLikeTypeInterface>( [this](auto type) { return this->translate(type); }) - .Default([](Type t) -> llvm::Type * { - llvm_unreachable("unknown LLVM dialect type"); - }); + .DefaultUnreachable("unknown LLVM dialect type"); // Cache the result of the conversion and return. knownTranslations.try_emplace(type, translated); diff --git a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp index 8dd971374fa21..34547e9fed062 100644 --- a/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp +++ b/mlir/tools/mlir-tblgen/AttrOrTypeFormatGen.cpp @@ -89,10 +89,7 @@ static ParameterElement *getEncapsulatedParameterElement(FormatElement *el) { .Case([&](auto param) { return param; }) .Case( [&](auto ref) { return cast(ref->getArg()); }) - .Default([&](auto el) { - assert(false && "unexpected struct element type"); - return nullptr; - }); + .DefaultUnreachable("unexpected struct element type"); } /// Shorthand functions that can be used with ranged-based conditions. From 8168f9b358dede5f78701aaea3cf19b152337b67 Mon Sep 17 00:00:00 2001 From: Jakub Kuderski Date: Sun, 5 Oct 2025 20:27:37 -0400 Subject: [PATCH 3/3] Add more cases --- mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp index 36685d3affe03..29b770fb4b279 100644 --- a/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp +++ b/mlir/lib/Dialect/SCF/Transforms/TileUsingInterface.cpp @@ -2177,10 +2177,9 @@ cloneAsInsertSlices(RewriterBase &rewriter, auto clonedOp = cloneAsInsertSlice(rewriter, op); clonedSlices.push_back(clonedOp); }) - .Default([&](Operation *op) { - // Assert here assuming this has already been checked. - assert(0 && "unexpected slice type while cloning as insert slice"); - }); + // Assert here assuming this has already been checked. + .DefaultUnreachable( + "unexpected slice type while cloning as insert slice"); } return clonedSlices; }