diff --git a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp --- a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp +++ b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp @@ -19,6 +19,7 @@ #include "mlir/IR/PatternMatch.h" #include "mlir/Transforms/DialectConversion.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/Support/ErrorHandling.h" #include namespace mlir::arith { @@ -81,8 +82,13 @@ Location loc = op->getLoc(); TypeConverter *converter = getTypeConverter(); SmallVector resultTypes; - LogicalResult pass = converter->convertTypes(op->getResultTypes(), resultTypes); - (void) pass; + LogicalResult didConvert = + converter->convertTypes(op->getResultTypes(), resultTypes); + if (failed(didConvert)) { + op->emitOpError( + "type conversion failed in float emulation, this can't happen"); + return; + } Operation *expandedOp = rewriter.create(loc, op->getName().getIdentifier(), operands, resultTypes, op->getAttrs(), op->getSuccessors(), /*regions=*/{});