[Mlir-commits] [mlir] 7f47005 - [mlir][linalg] Use cast instead of dyn_cast that's always dereferenced
Benjamin Kramer
llvmlistbot at llvm.org
Tue Jan 11 06:08:06 PST 2022
Author: Benjamin Kramer
Date: 2022-01-11T15:05:45+01:00
New Revision: 7f47005dcc6a1b78de9abca03db4115db7ad4aa1
URL: https://github.com/llvm/llvm-project/commit/7f47005dcc6a1b78de9abca03db4115db7ad4aa1
DIFF: https://github.com/llvm/llvm-project/commit/7f47005dcc6a1b78de9abca03db4115db7ad4aa1.diff
LOG: [mlir][linalg] Use cast instead of dyn_cast that's always dereferenced
This turns a random nullptr deref into an assertion failure in case
`tensor::registerInferTypeOpInterfaceExternalModels` isn't called.
Added:
Modified:
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
index 7115f9414b76a..190de342f5c7a 100644
--- a/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
+++ b/mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp
@@ -1009,7 +1009,7 @@ struct FoldInitTensorWithTensorReshapeOp
Location loc = reshapeOp.getLoc();
ReifiedRankedShapedTypeDims resultShapes;
ReifyRankedShapedTypeOpInterface reifyShapedTypeInterface =
- dyn_cast<ReifyRankedShapedTypeOpInterface>(reshapeOp.getOperation());
+ cast<ReifyRankedShapedTypeOpInterface>(reshapeOp.getOperation());
if (failed(reifyShapedTypeInterface.reifyResultShapes(rewriter,
resultShapes)) ||
!llvm::hasSingleElement(resultShapes))
More information about the Mlir-commits
mailing list