@@ -24,6 +24,7 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
24
24
_substs : SubstsRef < ' tcx > ,
25
25
args : & [ mir:: Operand < ' tcx > ] ,
26
26
ret : CPlace < ' tcx > ,
27
+ target : BasicBlock ,
27
28
span : Span ,
28
29
) {
29
30
match intrinsic {
@@ -277,16 +278,15 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
277
278
} else {
278
279
fx. tcx . sess . span_warn ( span, "Index argument for `simd_extract` is not a constant" ) ;
279
280
let trap_block = fx. bcx . create_block ( ) ;
280
- let dummy_block = fx. bcx . create_block ( ) ;
281
281
let true_ = fx. bcx . ins ( ) . iconst ( types:: I8 , 1 ) ;
282
282
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, & [ ] ) ;
284
285
fx. bcx . switch_to_block ( trap_block) ;
285
286
crate :: trap:: trap_unimplemented (
286
287
fx,
287
288
"Index argument for `simd_extract` is not a constant" ,
288
289
) ;
289
- fx. bcx . switch_to_block ( dummy_block) ;
290
290
return ;
291
291
} ;
292
292
@@ -876,7 +876,11 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
876
876
}
877
877
878
878
_ => {
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 ) ;
880
882
}
881
883
}
884
+ let ret_block = fx. get_block ( target) ;
885
+ fx. bcx . ins ( ) . jump ( ret_block, & [ ] ) ;
882
886
}
0 commit comments