@@ -1464,23 +1464,6 @@ impl<'a> Verifier<'a> {
14641464 Ok ( ( ) )
14651465 }
14661466
1467- fn pointer_type_or_error ( & self , inst : Inst , errors : & mut VerifierErrors ) -> Result < Type , ( ) > {
1468- // Ensure we have an ISA so we know what the pointer size is.
1469- if let Some ( isa) = self . isa {
1470- Ok ( isa. pointer_type ( ) )
1471- } else {
1472- errors
1473- . fatal ( (
1474- inst,
1475- self . context ( inst) ,
1476- format ! ( "need an ISA to validate correct pointer type" ) ,
1477- ) )
1478- // Will always return an `Err`, but the `Ok` type
1479- // doesn't match, so map it.
1480- . map ( |_| Type :: default ( ) )
1481- }
1482- }
1483-
14841467 fn typecheck_block_call (
14851468 & self ,
14861469 inst : Inst ,
@@ -1504,7 +1487,9 @@ impl<'a> Verifier<'a> {
15041487 ) ) ;
15051488 }
15061489 for ( arg, param) in args. zip ( block_params. iter ( ) ) {
1507- let arg_ty = self . block_call_arg_ty ( arg, inst, target_type, errors) ?;
1490+ let Some ( arg_ty) = self . block_call_arg_ty ( arg, inst, target_type, errors) ? else {
1491+ continue ;
1492+ } ;
15081493 let param_ty = self . func . dfg . value_type ( * param) ;
15091494 if arg_ty != param_ty {
15101495 errors. nonfatal ( (
@@ -1523,9 +1508,9 @@ impl<'a> Verifier<'a> {
15231508 inst : Inst ,
15241509 target_type : BlockCallTargetType ,
15251510 errors : & mut VerifierErrors ,
1526- ) -> Result < Type , ( ) > {
1511+ ) -> Result < Option < Type > , ( ) > {
15271512 match arg {
1528- BlockArg :: Value ( v) => Ok ( self . func . dfg . value_type ( v) ) ,
1513+ BlockArg :: Value ( v) => Ok ( Some ( self . func . dfg . value_type ( v) ) ) ,
15291514 BlockArg :: TryCallRet ( _) | BlockArg :: TryCallExn ( _) => {
15301515 // Get the invoked signature.
15311516 let et = match self . func . dfg . insts [ inst] . exception_table ( ) {
@@ -1548,7 +1533,7 @@ impl<'a> Verifier<'a> {
15481533 ( BlockArg :: TryCallRet ( i) , BlockCallTargetType :: ExNormalRet )
15491534 if ( i as usize ) < sig. returns . len ( ) =>
15501535 {
1551- Ok ( sig. returns [ i as usize ] . value_type )
1536+ Ok ( Some ( sig. returns [ i as usize ] . value_type ) )
15521537 }
15531538 ( BlockArg :: TryCallRet ( _) , BlockCallTargetType :: ExNormalRet ) => {
15541539 errors. fatal ( (
@@ -1567,20 +1552,24 @@ impl<'a> Verifier<'a> {
15671552 unreachable ! ( )
15681553 }
15691554 ( BlockArg :: TryCallExn ( i) , BlockCallTargetType :: Exception ) => {
1570- match sig
1571- . call_conv
1572- . exception_payload_types ( self . pointer_type_or_error ( inst, errors) ?)
1573- . get ( i as usize )
1574- {
1575- Some ( ty) => Ok ( * ty) ,
1576- None => {
1577- errors. fatal ( (
1578- inst,
1579- self . context ( inst) ,
1580- format ! ( "out-of-bounds `exnN` block argument" ) ,
1581- ) ) ?;
1582- unreachable ! ( )
1555+ if let Some ( isa) = self . isa {
1556+ match sig
1557+ . call_conv
1558+ . exception_payload_types ( isa. pointer_type ( ) )
1559+ . get ( i as usize )
1560+ {
1561+ Some ( ty) => Ok ( Some ( * ty) ) ,
1562+ None => {
1563+ errors. fatal ( (
1564+ inst,
1565+ self . context ( inst) ,
1566+ format ! ( "out-of-bounds `exnN` block argument" ) ,
1567+ ) ) ?;
1568+ unreachable ! ( )
1569+ }
15831570 }
1571+ } else {
1572+ Ok ( None )
15841573 }
15851574 }
15861575 ( BlockArg :: TryCallExn ( _) , _) => {
0 commit comments