[Mlir-commits] [mlir] a35f54c - [tosa][mlir] Add bailout to TosaMakeBroadcastable for unranked case
Rob Suderman
llvmlistbot at llvm.org
Tue Oct 26 15:38:54 PDT 2021
Author: Rob Suderman
Date: 2021-10-26T15:37:53-07:00
New Revision: a35f54c3b469ae9ea8d9ab7db0bab58c982ce36f
URL: https://github.com/llvm/llvm-project/commit/a35f54c3b469ae9ea8d9ab7db0bab58c982ce36f
DIFF: https://github.com/llvm/llvm-project/commit/a35f54c3b469ae9ea8d9ab7db0bab58c982ce36f.diff
LOG: [tosa][mlir] Add bailout to TosaMakeBroadcastable for unranked case
Dyn-cast should be checked and bailed out if the dyn_cast failed.
Reviewed By: sjarus, NatashaKnk
Differential Revision: https://reviews.llvm.org/D112574
Added:
Modified:
mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
index 14bd29f4c1a9c..c8fb9c505eeef 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaMakeBroadcastable.cpp
@@ -185,6 +185,8 @@ struct ConvertTosaOp : public OpRewritePattern<OpTy> {
Value output = tosaBinaryOp.getResult();
auto outputType = output.getType().dyn_cast<RankedTensorType>();
+ if (!outputType)
+ return failure();
Value outInput1, outInput2;
if (reshapeLowerToHigher(rewriter, tosaBinaryOp.getLoc(), outputType,
@@ -213,6 +215,8 @@ struct ConvertTosaOp<tosa::MulOp> : public OpRewritePattern<tosa::MulOp> {
int32_t shift = tosaBinaryOp.shift();
Value output = tosaBinaryOp.getResult();
auto outputType = output.getType().dyn_cast<RankedTensorType>();
+ if (!outputType)
+ return failure();
Value outInput1, outInput2;
if (reshapeLowerToHigher(rewriter, tosaBinaryOp.getLoc(), outputType,
@@ -243,6 +247,8 @@ struct ConvertTosaOp<tosa::ArithmeticRightShiftOp>
int32_t round = tosaBinaryOp.round();
Value output = tosaBinaryOp.getResult();
auto outputType = output.getType().dyn_cast<RankedTensorType>();
+ if (!outputType)
+ return failure();
Value outInput1, outInput2;
if (reshapeLowerToHigher(rewriter, tosaBinaryOp.getLoc(), outputType,
More information about the Mlir-commits
mailing list