forked from OSchip/llvm-project
[mlir] check for failures when packing function sigunatures in std->llvm conversion
When packing function results into a structure during the standard-to-llvm dialect conversion, do not assume the conversion was successful and propagate nullptr as error state. Fixes PR45184. Reviewed By: nicolasvasilache Differential Revision: https://reviews.llvm.org/D87605
This commit is contained in:
parent
c20852300a
commit
967c7b6936
|
@ -3390,7 +3390,7 @@ Type LLVMTypeConverter::packFunctionResults(ArrayRef<Type> types) {
|
|||
SmallVector<LLVM::LLVMType, 8> resultTypes;
|
||||
resultTypes.reserve(types.size());
|
||||
for (auto t : types) {
|
||||
auto converted = convertType(t).dyn_cast<LLVM::LLVMType>();
|
||||
auto converted = convertType(t).dyn_cast_or_null<LLVM::LLVMType>();
|
||||
if (!converted)
|
||||
return {};
|
||||
resultTypes.push_back(converted);
|
||||
|
|
|
@ -34,3 +34,7 @@ func @mlir_cast_to_llvm_vec(%0 : vector<1x1xf32>) -> !llvm.vec<1 x float> {
|
|||
|
||||
// Should not crash on unsupported types in function signatures.
|
||||
func @unsupported_signature() -> tensor<10 x i32>
|
||||
|
||||
// -----
|
||||
|
||||
func @partially_supported_signature() -> (vector<10 x i32>, tensor<10 x i32>)
|
||||
|
|
Loading…
Reference in New Issue