Build StKind::CopyOverlapping

This replaces where it was previously being constructed in intrinsics, with direct construction
of the Statement.
This commit is contained in:
kadmin 2021-01-23 03:55:41 +00:00
parent 83e6251f21
commit d30c497de6

View File

@ -837,10 +837,21 @@ fn codegen_stmt<'tcx>(
dst,
count,
}) => {
let dst = codegen_operand(fx, dst).load_scalar(fx);
let dst = codegen_operand(fx, dst);
let pointee = dst
.layout()
.pointee_info_at(fx, rustc_target::abi::Size::ZERO)
.expect("Expected pointer");
let dst = dst.load_scalar(fx);
let src = codegen_operand(fx, src).load_scalar(fx);
let count = codegen_operand(fx, count).load_scalar(fx);
fx.bcx.call_memcpy(fx.cx.module.target_config(), dst, src, count);
let elem_size: u64 = pointee.size.bytes();
let bytes = if elem_size != 1 {
fx.bcx.ins().imul_imm(count, elem_size as i64)
} else {
count
};
fx.bcx.call_memcpy(fx.cx.module.target_config(), dst, src, bytes);
}
}
}