[Mlir-commits] [mlir] [mlir][tablegen] Fix tablegen bug with `Complex` class (PR #104974)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Tue Aug 20 07:52:35 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-ods
@llvm/pr-subscribers-mlir-core
Author: Alex Rice (alexarice)
<details>
<summary>Changes</summary>
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.
@<!-- -->math-fehr
---
Full diff: https://github.com/llvm/llvm-project/pull/104974.diff
1 Files Affected:
- (modified) mlir/include/mlir/IR/CommonTypeConstraints.td (+5-5)
``````````diff
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>
``````````
</details>
https://github.com/llvm/llvm-project/pull/104974
More information about the Mlir-commits
mailing list