[Mlir-commits] [mlir] [mlir][tosa] Fix not to crash with large permutation indexes (PR #69857)

Jacques Pienaar llvmlistbot at llvm.org
Sat Oct 21 16:40:19 PDT 2023


================
@@ -966,6 +966,16 @@ LogicalResult tosa::TransposeOp::inferReturnTypeComponents(
   if (matchPattern(adaptor.getPerms(), m_Constant(&attr)) &&
       attr.getType().getRank() == 1) {
     ShapeAdaptor permShape = attr;
+    // Constant permutation must be the same length as the input rank.
+    if (inputShape.getRank() != permShape.getRank())
+      return failure();
----------------
jpienaar wrote:

return emitOptionalError(location, ...) ? 

https://github.com/llvm/llvm-project/pull/69857


More information about the Mlir-commits mailing list