forked from OSchip/llvm-project
Verify number of result types in generated builder.
Summary: This just bit me and is nasty to debug. Differential Revision: https://reviews.llvm.org/D76888
This commit is contained in:
parent
190df4a5bc
commit
6677477190
|
@ -38,6 +38,10 @@ def OpC : NS_Op<"three_normal_result_op", []> {
|
|||
// CHECK-NEXT: odsState.addTypes(resultType1)
|
||||
// CHECK-NEXT: odsState.addTypes(z)
|
||||
|
||||
// CHECK: void OpC::build(Builder *odsBuilder, OperationState &odsState, ArrayRef<Type> resultTypes) {
|
||||
// CHECK-NEXT: assert(resultTypes.size() == 3u && "mismatched number of results");
|
||||
// CHECK-NEXT: odsState.addTypes(resultTypes);
|
||||
|
||||
def IntegerTypeAttr : TypeAttrBase<"IntegerType", "Integer type attribute">;
|
||||
def OpD : NS_Op<"type_attr_as_result_type", [FirstAttrDerivedResultType]> {
|
||||
let arguments = (ins I32:$x, IntegerTypeAttr:$attr, F32Attr:$f32);
|
||||
|
|
|
@ -702,6 +702,11 @@ void OpEmitter::genSeparateArgParamBuilder() {
|
|||
}
|
||||
return;
|
||||
case TypeParamKind::Collective:
|
||||
body << " "
|
||||
<< "assert(resultTypes.size() "
|
||||
<< (op.getNumVariadicResults() == 0 ? "==" : ">=") << " "
|
||||
<< (op.getNumResults() - op.getNumVariadicResults())
|
||||
<< "u && \"mismatched number of results\");\n";
|
||||
body << " " << builderOpState << ".addTypes(resultTypes);\n";
|
||||
return;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue