@@ -204,6 +204,32 @@ func.func @concat_fold_zero(%arg0: tensor<?x0xf32>, %arg1: tensor<?x1xf32>, %arg
204204 %0 = tosa.concat %arg0 , %arg1 , %arg2 {axis = 1 : i32 }: (tensor <?x0 xf32 >, tensor <?x1 xf32 >, tensor <?x2 xf32 >) -> tensor <?x3 xf32 >
205205 return %0 : tensor <?x3 xf32 >
206206}
207+ // -----
208+
209+ // CHECK-LABEL: @concat_fold_zero
210+ func.func @concat_fold_zero_all (%arg0: tensor <?x0 xf32 >, %arg1: tensor <?x0 xf32 >) -> tensor <?x0 xf32 > {
211+ // CHECK: return %arg1
212+ %0 = tosa.concat %arg0 , %arg1 {axis = 1 : i32 }: (tensor <?x0 xf32 >, tensor <?x0 xf32 >) -> tensor <?x0 xf32 >
213+ return %0 : tensor <?x0 xf32 >
214+ }
215+
216+ // -----
217+
218+ // CHECK-LABEL: @concat_fold_zero
219+ func.func @concat_fold_zero_different_axis (%arg0: tensor <0x2x f32 >, %arg1: tensor <0x4x f32 >) -> tensor <0x6x f32 > {
220+ // CHECK: tosa.concat %arg0, %arg1
221+ %0 = tosa.concat %arg0 , %arg1 {axis = 1 : i32 }: (tensor <0x2x f32 >, tensor <0x4x f32 >) -> tensor <0x6x f32 >
222+ return %0 : tensor <0x6x f32 >
223+ }
224+
225+ // -----
226+
227+ // CHECK-LABEL: @concat_fold_zero_size
228+ func.func @concat_fold_zero_size (%arg0: tensor <?x0 xf32 >, %arg1: tensor <?x1 xf32 >, %arg2: tensor <?x2 xf32 >) -> tensor <?x3 xf32 > {
229+ // CHECK: tosa.concat %arg1, %arg2 {axis = 1 : i32}
230+ %0 = tosa.concat %arg0 , %arg1 , %arg2 {axis = 1 : i32 }: (tensor <?x0 xf32 >, tensor <?x1 xf32 >, tensor <?x2 xf32 >) -> tensor <?x3 xf32 >
231+ return %0 : tensor <?x3 xf32 >
232+ }
207233
208234// -----
209235
0 commit comments