@@ -268,10 +268,8 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
268
268
let val = codegen_operand ( fx, & val. node ) ;
269
269
270
270
// FIXME validate
271
- let idx_const = if let Some ( idx_const) =
272
- crate :: constant:: mir_operand_get_const_val ( fx, & idx. node )
273
- {
274
- idx_const
271
+ let idx_const = if let Some ( idx_const) = idx. node . constant ( ) {
272
+ crate :: constant:: eval_mir_constant ( fx, idx_const) . 0 . try_to_scalar_int ( ) . unwrap ( )
275
273
} else {
276
274
fx. tcx . dcx ( ) . span_fatal ( span, "Index argument for `simd_insert` is not a constant" ) ;
277
275
} ;
@@ -304,22 +302,12 @@ pub(super) fn codegen_simd_intrinsic_call<'tcx>(
304
302
return ;
305
303
}
306
304
307
- let idx_const = if let Some ( idx_const) =
308
- crate :: constant:: mir_operand_get_const_val ( fx, & idx. node )
309
- {
310
- idx_const
305
+ let idx_const = if let Some ( idx_const) = idx. node . constant ( ) {
306
+ crate :: constant:: eval_mir_constant ( fx, idx_const) . 0 . try_to_scalar_int ( ) . unwrap ( )
311
307
} else {
312
- fx. tcx . dcx ( ) . span_warn ( span, "Index argument for `simd_extract` is not a constant" ) ;
313
- let trap_block = fx. bcx . create_block ( ) ;
314
- let true_ = fx. bcx . ins ( ) . iconst ( types:: I8 , 1 ) ;
315
- let ret_block = fx. get_block ( target) ;
316
- fx. bcx . ins ( ) . brif ( true_, trap_block, & [ ] , ret_block, & [ ] ) ;
317
- fx. bcx . switch_to_block ( trap_block) ;
318
- crate :: trap:: trap_unimplemented (
319
- fx,
320
- "Index argument for `simd_extract` is not a constant" ,
321
- ) ;
322
- return ;
308
+ fx. tcx
309
+ . dcx ( )
310
+ . span_fatal ( span, "Index argument for `simd_extract` is not a constant" ) ;
323
311
} ;
324
312
325
313
let idx = idx_const. to_u32 ( ) ;
0 commit comments