@@ -24,6 +24,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
2424 _substs : SubstsRef < ' tcx > ,
2525 args : & [ mir:: Operand < ' tcx > ] ,
2626 ret : CPlace < ' tcx > ,
27+ target : BasicBlock ,
2728 span : Span ,
2829) {
2930 match intrinsic {
@@ -277,16 +278,15 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
277278 } else {
278279 fx. tcx . sess . span_warn ( span, "Index argument for `simd_extract` is not a constant" ) ;
279280 let trap_block = fx. bcx . create_block ( ) ;
280- let dummy_block = fx. bcx . create_block ( ) ;
281281 let true_ = fx. bcx . ins ( ) . iconst ( types:: I8 , 1 ) ;
282282 fx. bcx . ins ( ) . brnz ( true_, trap_block, & [ ] ) ;
283- fx. bcx . ins ( ) . jump ( dummy_block, & [ ] ) ;
283+ let ret_block = fx. get_block ( target) ;
284+ fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
284285 fx. bcx . switch_to_block ( trap_block) ;
285286 crate :: trap:: trap_unimplemented (
286287 fx,
287288 "Index argument for `simd_extract` is not a constant" ,
288289 ) ;
289- fx. bcx . switch_to_block ( dummy_block) ;
290290 return ;
291291 } ;
292292
@@ -876,7 +876,11 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
876876 }
877877
878878 _ => {
879- fx. tcx . sess . span_fatal ( span, & format ! ( "Unknown SIMD intrinsic {}" , intrinsic) ) ;
879+ fx. tcx . sess . span_err ( span, & format ! ( "Unknown SIMD intrinsic {}" , intrinsic) ) ;
880+ // Prevent verifier error
881+ fx. bcx . ins ( ) . trap ( TrapCode :: UnreachableCodeReached ) ;
880882 }
881883 }
884+ let ret_block = fx. get_block ( target) ;
885+ fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
882886}
0 commit comments