@@ -495,31 +495,6 @@ pub(crate) fn codegen_terminator_call<'tcx>(
495
495
. collect :: < Vec < _ > > ( )
496
496
} ;
497
497
498
- codegen_call_inner (
499
- fx,
500
- span,
501
- Some ( func) ,
502
- fn_ty,
503
- args,
504
- destination. map ( |( place, _) | place) ,
505
- ) ;
506
-
507
- if let Some ( ( _, dest) ) = destination {
508
- let ret_block = fx. get_block ( dest) ;
509
- fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
510
- } else {
511
- trap_unreachable ( fx, "[corruption] Diverging function returned" ) ;
512
- }
513
- }
514
-
515
- fn codegen_call_inner < ' tcx > (
516
- fx : & mut FunctionCx < ' _ , ' tcx , impl Backend > ,
517
- span : Span ,
518
- func : Option < & Operand < ' tcx > > ,
519
- fn_ty : Ty < ' tcx > ,
520
- args : Vec < CValue < ' tcx > > ,
521
- ret_place : Option < CPlace < ' tcx > > ,
522
- ) {
523
498
// FIXME mark the current block as cold when calling a `#[cold]` function.
524
499
let fn_sig = fx
525
500
. tcx
@@ -572,7 +547,7 @@ fn codegen_call_inner<'tcx>(
572
547
let nop_inst = fx. bcx . ins ( ) . nop ( ) ;
573
548
fx. add_comment ( nop_inst, "indirect call" ) ;
574
549
}
575
- let func = trans_operand ( fx, func. expect ( "indirect call without func Operand" ) )
550
+ let func = trans_operand ( fx, func)
576
551
. load_scalar ( fx) ;
577
552
(
578
553
Some ( func) ,
@@ -584,6 +559,7 @@ fn codegen_call_inner<'tcx>(
584
559
}
585
560
} ;
586
561
562
+ let ret_place = destination. map ( |( place, _) | place) ;
587
563
let ( call_inst, call_args) =
588
564
self :: returning:: codegen_with_call_return_arg ( fx, fn_sig, ret_place, |fx, return_ptr| {
589
565
let mut call_args: Vec < Value > = return_ptr
@@ -641,6 +617,13 @@ fn codegen_call_inner<'tcx>(
641
617
. collect :: < Vec < AbiParam > > ( ) ;
642
618
fx. bcx . func . dfg . signatures [ sig_ref] . params = abi_params;
643
619
}
620
+
621
+ if let Some ( ( _, dest) ) = destination {
622
+ let ret_block = fx. get_block ( dest) ;
623
+ fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
624
+ } else {
625
+ trap_unreachable ( fx, "[corruption] Diverging function returned" ) ;
626
+ }
644
627
}
645
628
646
629
pub ( crate ) fn codegen_drop < ' tcx > (
0 commit comments