Use zero_mem
instead of a zerointializer for init
intrinsic
LLVM gets overwhelmed when presented with a zeroinitializer for a large type. In unoptimised builds, it generates a long sequence of stores to memory. In optmised builds, it manages to generate a standard memset of zero values, but takes a long time doing so. Call out to the `llvm.memset` function to zero out the memory instead.
This commit is contained in:
parent
dcaeb6aa23
commit
0859e5ebb3
@ -361,12 +361,11 @@ pub fn trans_intrinsic_call<'a, 'blk, 'tcx>(mut bcx: Block<'blk, 'tcx>,
|
||||
}
|
||||
(_, "init") => {
|
||||
let tp_ty = *substs.types.get(FnSpace, 0);
|
||||
let lltp_ty = type_of::arg_type_of(ccx, tp_ty);
|
||||
if return_type_is_void(ccx, tp_ty) {
|
||||
C_nil(ccx)
|
||||
} else {
|
||||
C_null(lltp_ty)
|
||||
if !return_type_is_void(ccx, tp_ty) {
|
||||
// Just zero out the stack slot
|
||||
zero_mem(bcx, llresult, tp_ty);
|
||||
}
|
||||
C_nil(ccx)
|
||||
}
|
||||
// Effectively no-ops
|
||||
(_, "uninit") | (_, "forget") => {
|
||||
|
Loading…
Reference in New Issue
Block a user