[Mlir-commits] [mlir] 5f4d96e - Don't to real work inside an assertion.

Sterling Augustine llvmlistbot at llvm.org
Tue Jul 11 17:48:24 PDT 2023


Author: Sterling Augustine
Date: 2023-07-11T17:44:58-07:00
New Revision: 5f4d96ebef2387b1acffe3b6173a7fd625be0930

URL: https://github.com/llvm/llvm-project/commit/5f4d96ebef2387b1acffe3b6173a7fd625be0930
DIFF: https://github.com/llvm/llvm-project/commit/5f4d96ebef2387b1acffe3b6173a7fd625be0930.diff

LOG: Don't to real work inside an assertion.

asserts get compiled to empty when built in opt mode, so that makes
certain tests fail, such as emulate-unsupported-floats.mlir.test.

This removes the assert altogether, which is also suboptimal, but
I have reported to the original author.

Added: 
    

Modified: 
    mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
index f283ab7673b469..fba525813e157c 100644
--- a/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
+++ b/mlir/lib/Dialect/Arith/Transforms/EmulateUnsupportedFloats.cpp
@@ -79,10 +79,10 @@ LogicalResult EmulateFloatPattern::match(Operation *op) const {
 void EmulateFloatPattern::rewrite(Operation *op, ArrayRef<Value> operands,
                                   ConversionPatternRewriter &rewriter) const {
   Location loc = op->getLoc();
+  TypeConverter *converter = getTypeConverter();
   SmallVector<Type> resultTypes;
-  assert(
-      succeeded(getTypeConverter()->convertTypes(op->getResultTypes(), resultTypes)) &&
-      "type conversions shouldn't fail in this pass");
+  LogicalResult pass = converter->convertTypes(op->getResultTypes(), resultTypes);
+  (void) pass;
   Operation *expandedOp =
       rewriter.create(loc, op->getName().getIdentifier(), operands, resultTypes,
                       op->getAttrs(), op->getSuccessors(), /*regions=*/{});


        


More information about the Mlir-commits mailing list