From a26c027731fbee8a0a7c6e4a93a90f1ac73b4fd9 Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Thu, 4 Aug 2011 19:06:13 -0700 Subject: [PATCH] Revert "rustc: Don't emit memset for non-structural types" due to crashes This reverts commit 3d5a777fe19ab210aedf473678687a98023ff586. --- src/comp/middle/trans.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs index 8e270bb78a9..7e913c52839 100644 --- a/src/comp/middle/trans.rs +++ b/src/comp/middle/trans.rs @@ -2349,12 +2349,7 @@ fn drop_slot(cx: &@block_ctxt, slot: ValueRef, t: &ty::t) -> result { let re = drop_ty(cx, llptr, t); let llty = val_ty(slot); let llelemty = lib::llvm::llvm::LLVMGetElementType(llty); - if ty::type_is_structural(bcx_tcx(cx), t) { - call_bzero(cx, slot, C_uint(llsize_of_real(bcx_ccx(cx), llelemty)), - C_uint(llalign_of_real(bcx_ccx(cx), llelemty))); - } else { - cx.build.Store(C_null(llelemty), slot); - } + call_bzero(cx, slot, llsize_of(llelemty), C_uint(1u)); ret re; } @@ -5860,13 +5855,7 @@ fn zero_alloca(cx: &@block_ctxt, llptr: ValueRef, t: ty::t) -> result { bcx = call_bzero(llalign.bcx, llptr, llsz.val, llalign.val).bcx; } else { let llty = type_of(bcx_ccx(bcx), cx.sp, t); - if ty::type_is_structural(bcx_tcx(cx), t) { - bcx = call_bzero(cx, llptr, - C_uint(llsize_of_real(bcx_ccx(cx), llty)), - C_uint(llalign_of_real(bcx_ccx(cx), llty))).bcx; - } else { - bcx.build.Store(C_null(llty), llptr); - } + bcx = call_bzero(cx, llptr, llsize_of(llty), C_uint(1u)).bcx; } ret rslt(bcx, llptr); }