@@ -12,7 +12,7 @@ use crate::MemFlags;
12
12
use rustc_ast as ast;
13
13
use rustc_ast:: { InlineAsmOptions , InlineAsmTemplatePiece } ;
14
14
use rustc_hir:: lang_items:: LangItem ;
15
- use rustc_middle:: mir:: { self , AssertKind , SwitchTargets , UnwindTerminateReason } ;
15
+ use rustc_middle:: mir:: { self , AssertKind , BasicBlock , SwitchTargets , UnwindTerminateReason } ;
16
16
use rustc_middle:: ty:: layout:: { HasTyCtxt , LayoutOf , ValidityRequirement } ;
17
17
use rustc_middle:: ty:: print:: { with_no_trimmed_paths, with_no_visible_paths} ;
18
18
use rustc_middle:: ty:: { self , Instance , Ty } ;
@@ -832,8 +832,14 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
832
832
self . get_caller_location ( bx, mir:: SourceInfo { span : fn_span, ..source_info } ) ;
833
833
834
834
let mut llargs = Vec :: with_capacity ( arg_count) ;
835
- let ret_dest =
836
- self . make_return_dest ( bx, destination, & fn_abi. ret , & mut llargs, true , true ) ;
835
+ let ret_dest = self . make_return_dest (
836
+ bx,
837
+ destination,
838
+ & fn_abi. ret ,
839
+ & mut llargs,
840
+ intrinsic,
841
+ Some ( target) ,
842
+ ) ;
837
843
assert_eq ! ( llargs, [ ] ) ;
838
844
if let ReturnDest :: IndirectOperand ( tmp, _) = ret_dest {
839
845
location. val . store ( bx, tmp) ;
@@ -854,8 +860,8 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
854
860
destination,
855
861
& fn_abi. ret ,
856
862
& mut llargs,
857
- true ,
858
- target. is_some ( ) ,
863
+ Some ( intrinsic ) ,
864
+ target,
859
865
) ;
860
866
let dest = match ret_dest {
861
867
_ if fn_abi. ret . is_indirect ( ) => llargs[ 0 ] ,
@@ -919,7 +925,17 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
919
925
920
926
let mut llargs = Vec :: with_capacity ( arg_count) ;
921
927
let destination = target. as_ref ( ) . map ( |& target| {
922
- ( self . make_return_dest ( bx, destination, & fn_abi. ret , & mut llargs, false , true ) , target)
928
+ (
929
+ self . make_return_dest (
930
+ bx,
931
+ destination,
932
+ & fn_abi. ret ,
933
+ & mut llargs,
934
+ None ,
935
+ Some ( target) ,
936
+ ) ,
937
+ target,
938
+ )
923
939
} ) ;
924
940
925
941
// Split the rust-call tupled arguments off.
@@ -1652,10 +1668,10 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1652
1668
dest : mir:: Place < ' tcx > ,
1653
1669
fn_ret : & ArgAbi < ' tcx , Ty < ' tcx > > ,
1654
1670
llargs : & mut Vec < Bx :: Value > ,
1655
- is_intrinsic : bool ,
1656
- has_target : bool ,
1671
+ intrinsic : Option < ty :: IntrinsicDef > ,
1672
+ target : Option < BasicBlock > ,
1657
1673
) -> ReturnDest < ' tcx , Bx :: Value > {
1658
- if !has_target {
1674
+ if target . is_none ( ) {
1659
1675
return ReturnDest :: Nothing ;
1660
1676
}
1661
1677
// If the return is ignored, we can just return a do-nothing `ReturnDest`.
@@ -1676,7 +1692,7 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
1676
1692
tmp. storage_live ( bx) ;
1677
1693
llargs. push ( tmp. llval ) ;
1678
1694
ReturnDest :: IndirectOperand ( tmp, index)
1679
- } else if is_intrinsic {
1695
+ } else if intrinsic . is_some ( ) {
1680
1696
// Currently, intrinsics always need a location to store
1681
1697
// the result, so we create a temporary `alloca` for the
1682
1698
// result.
0 commit comments