[Mlir-commits] [mlir] [mlir][llvm dialect] Verify element type of nested types (PR #148975)

Tobias Gysi llvmlistbot at llvm.org
Tue Jul 15 23:31:30 PDT 2025


================
@@ -3215,22 +3228,13 @@ LogicalResult LLVM::ConstantOp::verify() {
       return emitOpError() << "expected array attribute of size "
                            << elementTypes.size();
     }
-    for (auto elementTy : elementTypes) {
-      if (!isa<IntegerType, FloatType, LLVMPPCFP128Type>(elementTy)) {
-        return emitOpError() << "expected struct element types to be floating "
-                                "point type or integer type";
-      }
-    }
-
-    for (size_t i = 0; i < elementTypes.size(); ++i) {
-      Attribute element = arrayAttr[i];
-      if (!isa<IntegerAttr, FloatAttr>(element)) {
-        return emitOpError()
-               << "expected struct element attribute types to be floating "
-                  "point type or integer type";
+    for (auto [i, attr, type] : llvm::enumerate(arrayAttr, elementTypes)) {
+      if (!isa<IntegerAttr, FloatAttr>(attr)) {
+        return emitOpError() << "expected element of array attribute to be "
----------------
gysit wrote:

I would keep original error message since this code path is executed for struct constants?

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


More information about the Mlir-commits mailing list