[Mlir-commits] [mlir] Upstream polynomial.ntt and polynomial.intt (PR #90992)

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Sat May 4 13:51:53 PDT 2024


================
@@ -202,11 +202,30 @@ Attribute RingAttr::parse(AsmParser &parser, Type type) {
     polyAttr = attr;
   }
 
+  Polynomial poly = polyAttr.getPolynomial();
+  APInt root(coefficientModulusAttr.getValue().getBitWidth(), 0);
+  bool hasRoot = succeeded(parser.parseOptionalComma());
+  IntegerAttr rootAttr = nullptr;
+  if (hasRoot) {
+    if (failed(parser.parseKeyword("primitiveRoot")))
+      return {};
+
+    if (failed(parser.parseEqual()))
+      return {};
----------------
ftynse wrote:

```suggestion
    if (failed(parser.parseKeyword("primitiveRoot")) ||
        failed(parser.parseEqual()))
      return {};
```

(you can even omit the `failed` and have the same effect, but I personally prefer being explicit.

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


More information about the Mlir-commits mailing list