forked from OSchip/llvm-project
Return failure on failure in convertBlockSignature.
This was causing a subsequent assert/crash when a type converter failed to convert a block argument. Reviewed By: rriddle Differential Revision: https://reviews.llvm.org/D110985
This commit is contained in:
parent
ae4c0c7cfc
commit
56272257f3
|
@ -1147,6 +1147,8 @@ FailureOr<Block *> ConversionPatternRewriterImpl::convertBlockSignature(
|
|||
block, converter, *conversion, mapping, argReplacements)
|
||||
: argConverter.convertSignature(block, converter, mapping,
|
||||
argReplacements);
|
||||
if (failed(result))
|
||||
return failure();
|
||||
if (Block *newBlock = result.getValue()) {
|
||||
if (newBlock != block)
|
||||
blockActions.push_back(BlockAction::getTypeConversion(newBlock));
|
||||
|
|
|
@ -99,3 +99,17 @@ func @test_signature_conversion_undo() {
|
|||
}) : () -> ()
|
||||
return
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
// Should not segfault here but gracefully fail.
|
||||
// CHECK-LABEL: func @test_block_argument_not_converted
|
||||
func @test_block_argument_not_converted() {
|
||||
"test.unsupported_block_arg_type"() ({
|
||||
// NOTE: The test pass does not convert `index` types.
|
||||
// CHECK: ^bb0({{.*}}: index):
|
||||
^bb0(%0 : index):
|
||||
"test.return"(%0) : (index) -> ()
|
||||
}) : () -> ()
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue