forked from OSchip/llvm-project
[mlir] std.call reference function return types in failure
Makes it easier to see type mismatch from failure locally. Differential Revision: https://reviews.llvm.org/D107288
This commit is contained in:
parent
7138f1cd13
commit
9d10be70a8
|
@ -622,8 +622,12 @@ LogicalResult CallOp::verifySymbolUses(SymbolTableCollection &symbolTable) {
|
|||
return emitOpError("incorrect number of results for callee");
|
||||
|
||||
for (unsigned i = 0, e = fnType.getNumResults(); i != e; ++i)
|
||||
if (getResult(i).getType() != fnType.getResult(i))
|
||||
return emitOpError("result type mismatch");
|
||||
if (getResult(i).getType() != fnType.getResult(i)) {
|
||||
auto diag = emitOpError("result type mismatch at index ") << i;
|
||||
diag.attachNote() << " op result types: " << getResultTypes();
|
||||
diag.attachNote() << "function result types: " << fnType.getResults();
|
||||
return diag;
|
||||
}
|
||||
|
||||
return success();
|
||||
}
|
||||
|
|
|
@ -69,3 +69,19 @@ func @complex_constant_two_different_element_types() {
|
|||
%0 = constant [1.0 : f32, -1.0 : f64] : complex<f64>
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
func @return_i32_f32() -> (i32, f32) {
|
||||
%0 = constant 1 : i32
|
||||
%1 = constant 1. : f32
|
||||
return %0, %1 : i32, f32
|
||||
}
|
||||
|
||||
func @call() {
|
||||
// expected-error @+3 {{op result type mismatch at index 0}}
|
||||
// expected-note @+2 {{op result types: 'f32', 'i32'}}
|
||||
// expected-note @+1 {{function result types: 'i32', 'f32'}}
|
||||
%0:2 = call @return_i32_f32() : () -> (f32, i32)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue