mirror of https://github.com/llvm/circt.git
[Comb] Drop redundant concat verifier (#8454)
This commit is contained in:
parent
daf5c25691
commit
9a326368bb
|
@ -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))";
|
||||||
|
|
||||||
|
|
|
@ -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});
|
||||||
|
|
|
@ -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
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue