@@ -641,67 +641,89 @@ impl<'a, 'tcx, Bx: BuilderMethods<'a, 'tcx>> FunctionCx<'a, 'tcx, Bx> {
641
641
return ;
642
642
}
643
643
644
- if intrinsic. is_some ( ) && intrinsic != Some ( sym:: drop_in_place) {
645
- let intrinsic = intrinsic. unwrap ( ) ;
646
- let dest = match ret_dest {
647
- _ if fn_abi. ret . is_indirect ( ) => llargs[ 0 ] ,
648
- ReturnDest :: Nothing => {
649
- bx. const_undef ( bx. type_ptr_to ( bx. arg_memory_ty ( & fn_abi. ret ) ) )
650
- }
651
- ReturnDest :: IndirectOperand ( dst, _) | ReturnDest :: Store ( dst) => dst. llval ,
652
- ReturnDest :: DirectOperand ( _) => {
653
- bug ! ( "Cannot use direct operand with an intrinsic call" )
654
- }
655
- } ;
644
+ match intrinsic {
645
+ None | Some ( sym:: drop_in_place) => { }
646
+ Some ( sym:: copy_nonoverlapping) => {
647
+ bx = self . codegen_statement (
648
+ bx,
649
+ & rustc_middle:: mir:: Statement {
650
+ source_info : rustc_middle:: mir:: SourceInfo :: outermost ( span) ,
651
+ kind : rustc_middle:: mir:: StatementKind :: CopyNonOverlapping (
652
+ box rustc_middle:: mir:: CopyNonOverlapping {
653
+ src : args[ 0 ] . clone ( ) ,
654
+ dst : args[ 1 ] . clone ( ) ,
655
+ count : args[ 2 ] . clone ( ) ,
656
+ } ,
657
+ ) ,
658
+ } ,
659
+ ) ;
660
+ helper. funclet_br ( self , & mut bx, destination. unwrap ( ) . 1 ) ;
661
+ return ;
662
+ }
663
+ Some ( intrinsic) => {
664
+ let dest = match ret_dest {
665
+ _ if fn_abi. ret . is_indirect ( ) => llargs[ 0 ] ,
666
+ ReturnDest :: Nothing => {
667
+ bx. const_undef ( bx. type_ptr_to ( bx. arg_memory_ty ( & fn_abi. ret ) ) )
668
+ }
669
+ ReturnDest :: IndirectOperand ( dst, _) | ReturnDest :: Store ( dst) => dst. llval ,
670
+ ReturnDest :: DirectOperand ( _) => {
671
+ bug ! ( "Cannot use direct operand with an intrinsic call" )
672
+ }
673
+ } ;
656
674
657
- let args: Vec < _ > = args
658
- . iter ( )
659
- . enumerate ( )
660
- . map ( |( i, arg) | {
661
- // The indices passed to simd_shuffle* in the
662
- // third argument must be constant. This is
663
- // checked by const-qualification, which also
664
- // promotes any complex rvalues to constants.
665
- if i == 2 && intrinsic. as_str ( ) . starts_with ( "simd_shuffle" ) {
666
- if let mir:: Operand :: Constant ( constant) = arg {
667
- let c = self . eval_mir_constant ( constant) ;
668
- let ( llval, ty) = self . simd_shuffle_indices (
669
- & bx,
670
- constant. span ,
671
- constant. literal . ty ,
672
- c,
673
- ) ;
674
- return OperandRef { val : Immediate ( llval) , layout : bx. layout_of ( ty) } ;
675
- } else {
676
- span_bug ! ( span, "shuffle indices must be constant" ) ;
675
+ let args: Vec < _ > = args
676
+ . iter ( )
677
+ . enumerate ( )
678
+ . map ( |( i, arg) | {
679
+ // The indices passed to simd_shuffle* in the
680
+ // third argument must be constant. This is
681
+ // checked by const-qualification, which also
682
+ // promotes any complex rvalues to constants.
683
+ if i == 2 && intrinsic. as_str ( ) . starts_with ( "simd_shuffle" ) {
684
+ if let mir:: Operand :: Constant ( constant) = arg {
685
+ let c = self . eval_mir_constant ( constant) ;
686
+ let ( llval, ty) = self . simd_shuffle_indices (
687
+ & bx,
688
+ constant. span ,
689
+ constant. literal . ty ,
690
+ c,
691
+ ) ;
692
+ return OperandRef {
693
+ val : Immediate ( llval) ,
694
+ layout : bx. layout_of ( ty) ,
695
+ } ;
696
+ } else {
697
+ span_bug ! ( span, "shuffle indices must be constant" ) ;
698
+ }
677
699
}
678
- }
679
700
680
- self . codegen_operand ( & mut bx, arg)
681
- } )
682
- . collect ( ) ;
701
+ self . codegen_operand ( & mut bx, arg)
702
+ } )
703
+ . collect ( ) ;
704
+
705
+ self . codegen_intrinsic_call (
706
+ & mut bx,
707
+ * instance. as_ref ( ) . unwrap ( ) ,
708
+ & fn_abi,
709
+ & args,
710
+ dest,
711
+ span,
712
+ ) ;
683
713
684
- Self :: codegen_intrinsic_call (
685
- & mut bx,
686
- * instance. as_ref ( ) . unwrap ( ) ,
687
- & fn_abi,
688
- & args,
689
- dest,
690
- span,
691
- ) ;
714
+ if let ReturnDest :: IndirectOperand ( dst, _) = ret_dest {
715
+ self . store_return ( & mut bx, ret_dest, & fn_abi. ret , dst. llval ) ;
716
+ }
692
717
693
- if let ReturnDest :: IndirectOperand ( dst, _) = ret_dest {
694
- self . store_return ( & mut bx, ret_dest, & fn_abi. ret , dst. llval ) ;
695
- }
718
+ if let Some ( ( _, target) ) = * destination {
719
+ helper. maybe_sideeffect ( self . mir , & mut bx, & [ target] ) ;
720
+ helper. funclet_br ( self , & mut bx, target) ;
721
+ } else {
722
+ bx. unreachable ( ) ;
723
+ }
696
724
697
- if let Some ( ( _, target) ) = * destination {
698
- helper. maybe_sideeffect ( self . mir , & mut bx, & [ target] ) ;
699
- helper. funclet_br ( self , & mut bx, target) ;
700
- } else {
701
- bx. unreachable ( ) ;
725
+ return ;
702
726
}
703
-
704
- return ;
705
727
}
706
728
707
729
// Split the rust-call tupled arguments off.
0 commit comments