[Mlir-commits] [mlir] 9bcac22 - [MLIR][Tensor] Remove assert in PadOp builder

Lorenzo Chelini llvmlistbot at llvm.org
Wed Oct 19 09:02:57 PDT 2022


Author: Lorenzo Chelini
Date: 2022-10-19T18:02:50+02:00
New Revision: 9bcac22be559842cf488db469964fce37c2035a3

URL: https://github.com/llvm/llvm-project/commit/9bcac22be559842cf488db469964fce37c2035a3
DIFF: https://github.com/llvm/llvm-project/commit/9bcac22be559842cf488db469964fce37c2035a3.diff

LOG: [MLIR][Tensor] Remove assert in PadOp builder

The assert is misplaced as the result type is allowed to be null. A few
lines below the result type is inferred if it is passed a nullptr.
Besides, this behavior is described in the documentation of the builder.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D136262

Added: 
    

Modified: 
    mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index 0ee79a6ea268e..dd92ef2e1cd75 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -2407,7 +2407,6 @@ void PadOp::build(OpBuilder &b, OperationState &result, Type resultType,
                   Value source, ArrayRef<OpFoldResult> low,
                   ArrayRef<OpFoldResult> high, bool nofold,
                   ArrayRef<NamedAttribute> attrs) {
-  assert(resultType.isa<RankedTensorType>());
   auto sourceType = source.getType().cast<RankedTensorType>();
   SmallVector<Value, 4> dynamicLow, dynamicHigh;
   SmallVector<int64_t, 4> staticLow, staticHigh;


        


More information about the Mlir-commits mailing list