[Mlir-commits] [mlir] [mlir][Arith][EmitC] Bail-out on arith.constant conversions to EmitC (PR #201565)

Andrzej WarzyƄski llvmlistbot at llvm.org
Thu Jun 4 07:33:37 PDT 2026


================
@@ -21,3 +21,27 @@ func.func @unsuppoted_emitc_type(%arg0: i4, %arg1: i4) {
   %0 = arith.addi %arg0, %arg1 : i4
   return
 }
+
+// -----
+
+func.func private @rank0_constant() -> memref<i64> {
+  // expected-error at +1 {{failed to legalize operation 'arith.constant'}}
+  %0 = arith.constant dense<-1> : memref<i64>
+  return %0 : memref<i64>
+}
+
+// -----
+
+func.func private @rank1_constant() -> memref<1xi64> {
+  // expected-error at +1 {{failed to legalize operation 'arith.constant'}}
+  %0 = arith.constant dense<[-1]> : memref<1xi64>
+  return %0 : memref<1xi64>
+}
+
+// -----
+
+func.func private @return_rank2_constant() -> memref<1x1xi64> {
----------------
banach-space wrote:

For consistency with the other tests:
```suggestion
func.func private @rank2_constant() -> memref<1x1xi64> {
```

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


More information about the Mlir-commits mailing list