@@ -641,67 +641,73 @@ 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) => unreachable ! ( ) ,
647
+ Some ( intrinsic) => {
648
+ let dest = match ret_dest {
649
+ _ if fn_abi. ret . is_indirect ( ) => llargs[ 0 ] ,
650
+ ReturnDest :: Nothing => {
651
+ bx. const_undef ( bx. type_ptr_to ( bx. arg_memory_ty ( & fn_abi. ret ) ) )
652
+ }
653
+ ReturnDest :: IndirectOperand ( dst, _) | ReturnDest :: Store ( dst) => dst. llval ,
654
+ ReturnDest :: DirectOperand ( _) => {
655
+ bug ! ( "Cannot use direct operand with an intrinsic call" )
656
+ }
657
+ } ;
656
658
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" ) ;
659
+ let args: Vec < _ > = args
660
+ . iter ( )
661
+ . enumerate ( )
662
+ . map ( |( i, arg) | {
663
+ // The indices passed to simd_shuffle* in the
664
+ // third argument must be constant. This is
665
+ // checked by const-qualification, which also
666
+ // promotes any complex rvalues to constants.
667
+ if i == 2 && intrinsic. as_str ( ) . starts_with ( "simd_shuffle" ) {
668
+ if let mir:: Operand :: Constant ( constant) = arg {
669
+ let c = self . eval_mir_constant ( constant) ;
670
+ let ( llval, ty) = self . simd_shuffle_indices (
671
+ & bx,
672
+ constant. span ,
673
+ constant. literal . ty ,
674
+ c,
675
+ ) ;
676
+ return OperandRef {
677
+ val : Immediate ( llval) ,
678
+ layout : bx. layout_of ( ty) ,
679
+ } ;
680
+ } else {
681
+ span_bug ! ( span, "shuffle indices must be constant" ) ;
682
+ }
677
683
}
678
- }
679
684
680
- self . codegen_operand ( & mut bx, arg)
681
- } )
682
- . collect ( ) ;
685
+ self . codegen_operand ( & mut bx, arg)
686
+ } )
687
+ . collect ( ) ;
688
+
689
+ Self :: codegen_intrinsic_call (
690
+ & mut bx,
691
+ * instance. as_ref ( ) . unwrap ( ) ,
692
+ & fn_abi,
693
+ & args,
694
+ dest,
695
+ span,
696
+ ) ;
683
697
684
- Self :: codegen_intrinsic_call (
685
- & mut bx,
686
- * instance. as_ref ( ) . unwrap ( ) ,
687
- & fn_abi,
688
- & args,
689
- dest,
690
- span,
691
- ) ;
698
+ if let ReturnDest :: IndirectOperand ( dst, _) = ret_dest {
699
+ self . store_return ( & mut bx, ret_dest, & fn_abi. ret , dst. llval ) ;
700
+ }
692
701
693
- if let ReturnDest :: IndirectOperand ( dst, _) = ret_dest {
694
- self . store_return ( & mut bx, ret_dest, & fn_abi. ret , dst. llval ) ;
695
- }
702
+ if let Some ( ( _, target) ) = * destination {
703
+ helper. maybe_sideeffect ( self . mir , & mut bx, & [ target] ) ;
704
+ helper. funclet_br ( self , & mut bx, target) ;
705
+ } else {
706
+ bx. unreachable ( ) ;
707
+ }
696
708
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 ( ) ;
709
+ return ;
702
710
}
703
-
704
- return ;
705
711
}
706
712
707
713
// Split the rust-call tupled arguments off.
0 commit comments