[Mlir-commits] [mlir] [mlir][tosa] Check empty Concat input for inferReturnTypeComponents (PR #134728)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Apr 7 13:53:20 PDT 2025


https://github.com/Jerry-Ge created https://github.com/llvm/llvm-project/pull/134728

None

>From bfd67a167b8865519ceef22bf9081921c8f88cc2 Mon Sep 17 00:00:00 2001
From: Jerry Ge <jerry.ge at arm.com>
Date: Mon, 7 Apr 2025 13:52:04 -0700
Subject: [PATCH] [mlir][tosa] Check empty Concat input for
 inferReturnTypeComponents

Signed-off-by: Jerry Ge <jerry.ge at arm.com>
Change-Id: I72e6f9bbdefca533f49e9c273d6a0d58aa30e4c1
---
 mlir/lib/Dialect/Tosa/IR/TosaOps.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
index c8e9ad8bd3346..889fe7a6bdb25 100644
--- a/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
+++ b/mlir/lib/Dialect/Tosa/IR/TosaOps.cpp
@@ -1066,6 +1066,10 @@ LogicalResult tosa::ConcatOp::inferReturnTypeComponents(
 
     hasRankedInput = true;
   }
+  
+  if (adaptor.getInput1().empty())
+    return failure();
+
   Type inputType =
       llvm::cast<TensorType>(adaptor.getInput1().getType()[0]).getElementType();
   if (!hasRankedInput) {



More information about the Mlir-commits mailing list