@@ -30,13 +30,6 @@ ParseResult parseMonomial(AsmParser &parser, Monomial &monomial,
3030 llvm::StringRef &variable, bool *isConstantTerm) {
3131 APInt parsedCoeff (apintBitWidth, 1 );
3232 auto result = parser.parseOptionalInteger (parsedCoeff);
33- if (result.has_value ()) {
34- if (failed (*result)) {
35- parser.emitError (parser.getCurrentLocation (),
36- " invalid integer coefficient" );
37- return failure ();
38- }
39- }
4033
4134 // Variable name
4235 result = parser.parseOptionalKeyword (&variable);
@@ -118,13 +111,14 @@ Attribute PolynomialAttr::parse(AsmParser &parser, Type type) {
118111 if (failed (parser.parseOptionalPlus ())) {
119112 if (succeeded (parser.parseGreater ())) {
120113 break ;
121- } else {
122- parser.emitError (
123- parser.getCurrentLocation (),
124- " expected + and more monomials, or > to end polynomial attribute" );
125- return {};
126114 }
127- } else if (succeeded (parser.parseOptionalGreater ())) {
115+ parser.emitError (
116+ parser.getCurrentLocation (),
117+ " expected + and more monomials, or > to end polynomial attribute" );
118+ return {};
119+ }
120+
121+ if (succeeded (parser.parseOptionalGreater ())) {
128122 parser.emitError (
129123 parser.getCurrentLocation (),
130124 " expected another monomial after +, but found > ending attribute" );
@@ -175,8 +169,7 @@ Attribute RingAttr::parse(AsmParser &parser, Type type) {
175169 IntegerType iType = llvm::dyn_cast<IntegerType>(typeAttr.getValue ());
176170 if (!iType) {
177171 parser.emitError (parser.getCurrentLocation (),
178- " invalid coefficient modulus, coefficientType must "
179- " specify an integer type" );
172+ " coefficientType must specify an integer type" );
180173 return {};
181174 }
182175 APInt coefficientModulus (iType.getWidth (), 0 );
0 commit comments