[Mlir-commits] [mlir] 655d62c - [mlir][tablegen] Fix tablegen bug with `Complex` class (#104974)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue Aug 20 11:03:35 PDT 2024


Author: Alex Rice
Date: 2024-08-20T19:03:31+01:00
New Revision: 655d62c4b326f2606b1e89a4dff0212c1d9226ab

URL: https://github.com/llvm/llvm-project/commit/655d62c4b326f2606b1e89a4dff0212c1d9226ab
DIFF: https://github.com/llvm/llvm-project/commit/655d62c4b326f2606b1e89a4dff0212c1d9226ab.diff

LOG: [mlir][tablegen] Fix tablegen bug with `Complex` class (#104974)

The `Complex` class in tablegen tries to store its element type, but due
to a name collision it actually ends up storing the `type` field of the
`ConfinedType` superclass, and so `elementType` is always set to
`AnyComplex`.

This renames the field so that it gets correctly set.

Added: 
    

Modified: 
    mlir/include/mlir/IR/CommonTypeConstraints.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/IR/CommonTypeConstraints.td b/mlir/include/mlir/IR/CommonTypeConstraints.td
index 70c3e485679e57..4536d781ef674f 100644
--- a/mlir/include/mlir/IR/CommonTypeConstraints.td
+++ b/mlir/include/mlir/IR/CommonTypeConstraints.td
@@ -348,16 +348,16 @@ def F8E3M4 : Type<CPred<"$_self.isFloat8E3M4()">, "f8E3M4 type">,
 def AnyComplex : Type<CPred<"::llvm::isa<::mlir::ComplexType>($_self)">,
                       "complex-type", "::mlir::ComplexType">;
 
-class Complex<Type type>
+class Complex<Type elType>
     : ConfinedType<AnyComplex, [
           SubstLeaves<"$_self",
                       "::llvm::cast<::mlir::ComplexType>($_self).getElementType()",
-           type.predicate>],
-           "complex type with " # type.summary # " elements",
+           elType.predicate>],
+           "complex type with " # elType.summary # " elements",
            "::mlir::ComplexType">,
-      SameBuildabilityAs<type, "::mlir::ComplexType::get($_builder.get" # type #
+      SameBuildabilityAs<elType, "::mlir::ComplexType::get($_builder.get" # elType #
                                "Type())"> {
-  Type elementType = type;
+  Type elementType = elType;
 }
 
 class OpaqueType<string dialect, string name, string summary>


        


More information about the Mlir-commits mailing list