[Comb] Drop redundant concat verifier (#8454)

This commit is contained in:
Bea Healy 2025-04-30 08:38:48 +01:00 committed by GitHub
parent daf5c25691
commit 9a326368bb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 13 deletions

View File

@ -214,7 +214,6 @@ def ConcatOp : CombOp<"concat", [InferTypeOpInterface, Pure]> {
let hasFolder = true; let hasFolder = true;
let hasCanonicalizeMethod = true; let hasCanonicalizeMethod = true;
let hasVerifier = 1;
let assemblyFormat = "$inputs attr-dict `:` qualified(type($inputs))"; let assemblyFormat = "$inputs attr-dict `:` qualified(type($inputs))";

View File

@ -297,18 +297,6 @@ static unsigned getTotalWidth(ValueRange inputs) {
return resultWidth; return resultWidth;
} }
LogicalResult ConcatOp::verify() {
unsigned tyWidth = cast<IntegerType>(getType()).getWidth();
unsigned operandsTotalWidth = getTotalWidth(getInputs());
if (tyWidth != operandsTotalWidth)
return emitOpError("ConcatOp requires operands total width to "
"match type width. operands "
"totalWidth is")
<< operandsTotalWidth << ", but concatOp type width is " << tyWidth;
return success();
}
void ConcatOp::build(OpBuilder &builder, OperationState &result, Value hd, void ConcatOp::build(OpBuilder &builder, OperationState &result, Value hd,
ValueRange tl) { ValueRange tl) {
result.addOperands(ValueRange{hd}); result.addOperands(ValueRange{hd});

View File

@ -11,3 +11,22 @@ hw.module @err(in %a: i1, in %b: i1) {
// expected-error @+1 {{Truth tables support a maximum of 63 inputs}} // expected-error @+1 {{Truth tables support a maximum of 63 inputs}}
%0 = comb.truth_table %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b -> [false] %0 = comb.truth_table %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b, %a, %b -> [false]
} }
// -----
hw.module @err(in %a: i4, out out: i7) {
// expected-note @+1 {{prior use here}}
%0 = comb.concat %a, %a : i4, i4
// expected-error @+1 {{use of value '%0' expects different type than prior uses: 'i7' vs 'i8'}}
hw.output %0 : i7
}
// -----
// Check return type is still inferred correctly with generic parser
hw.module @err(in %a: i4, out out: i7) {
// expected-error @+2 {{'comb.concat' op inferred type(s) 'i8' are incompatible with return type(s) of operation 'i7'}}
// expected-error @+1 {{'comb.concat' op failed to infer returned types}}
%0 = "comb.concat"(%a, %a) : (i4, i4) -> i7
hw.output %0 : i7
}