diff --git a/mlir/include/mlir/IR/OpDefinition.h b/mlir/include/mlir/IR/OpDefinition.h --- a/mlir/include/mlir/IR/OpDefinition.h +++ b/mlir/include/mlir/IR/OpDefinition.h @@ -1257,9 +1257,12 @@ static bool classof(Operation *op) { if (auto *abstractOp = op->getAbstractOperation()) return TypeID::get() == abstractOp->typeID; - assert(op->getContext()->isOperationRegistered( - ConcreteType::getOperationName()) && - "Casting attempt to an unregistered operation"); +#ifndef NDEBUG + if (op->getName().getStringRef() == ConcreteType::getOperationName()) + llvm::report_fatal_error( + "classof on '" + ConcreteType::getOperationName() + + "' failed due to the operation not being registered"); +#endif return false; }