diff options
| author | bjorn3 <bjorn3@users.noreply.github.com> | 2021-07-19 15:34:33 +0200 |
|---|---|---|
| committer | bjorn3 <bjorn3@users.noreply.github.com> | 2021-07-19 15:34:33 +0200 |
| commit | 356360836e128e1d1eb11caf6ff5186efb211960 (patch) | |
| tree | 94540330bb097084177cc2ddb0f7e49742679c97 | |
| parent | 0ebb4839f673d911b148639009d264fb7ef02d24 (diff) | |
| download | rust-356360836e128e1d1eb11caf6ff5186efb211960.tar.gz rust-356360836e128e1d1eb11caf6ff5186efb211960.zip | |
Avoid call to pointer_ty
| -rw-r--r-- | src/intrinsics/mod.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/intrinsics/mod.rs b/src/intrinsics/mod.rs index 3979886e10c..42483230fdc 100644 --- a/src/intrinsics/mod.rs +++ b/src/intrinsics/mod.rs @@ -1122,6 +1122,7 @@ pub(crate) fn codegen_intrinsic_call<'tcx>( } let size = fx.layout_of(T).layout.size; + // FIXME add and use emit_small_memcmp let is_eq_value = if size == Size::ZERO { // No bytes means they're trivially equal @@ -1137,10 +1138,9 @@ pub(crate) fn codegen_intrinsic_call<'tcx>( } else { // Just call `memcmp` (like slices do in core) when the // size is too large or it's not a power-of-two. - let ptr_ty = pointer_ty(fx.tcx); let signed_bytes = i64::try_from(size.bytes()).unwrap(); - let bytes_val = fx.bcx.ins().iconst(ptr_ty, signed_bytes); - let params = vec![AbiParam::new(ptr_ty); 3]; + let bytes_val = fx.bcx.ins().iconst(fx.pointer_type, signed_bytes); + let params = vec![AbiParam::new(fx.pointer_type); 3]; let returns = vec![AbiParam::new(types::I32)]; let args = &[lhs_ref, rhs_ref, bytes_val]; let cmp = fx.lib_call("memcmp", params, returns, args)[0]; |
