[Mlir-commits] [mlir] [TableGen] Use getValue instead of getInt for enum attributes (PR #144030)

Ryan Thomas Lynch llvmlistbot at llvm.org
Fri Jun 13 11:47:10 PDT 2025


================
@@ -39,8 +39,9 @@ class EnumCase<string sym, int intVal, string strVal, int widthVal> {
 class IntEnumAttrCaseBase<I intType, string sym, string strVal, int intVal> :
     EnumCase<sym, intVal, strVal, intType.bitwidth>,
     SignlessIntegerAttrBase<intType, "case " # strVal> {
-  let predicate =
-    CPred<"::llvm::cast<::mlir::IntegerAttr>($_self).getInt() == " # intVal>;
+  let predicate = CPred<
+      "::llvm::cast<::mlir::IntegerAttr>($_self).getValue().eq(::llvm::APInt("#intType
----------------
emosy wrote:

can you explain why you use `getValue()` here and `getValue().getZExtValue()` in the enums gen?

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


More information about the Mlir-commits mailing list