Use llvm.memset instead of _d_array_init_i1 and _d_array_init_i8.

This exposes what's happening to LLVM, and memset is probably faster than the
runtime functions we were using anyway.
This commit is contained in:
Frits van Bommel
2009-06-07 13:57:59 +02:00
parent 1958e17734
commit f79e40a491
4 changed files with 22 additions and 22 deletions
+9 -2
View File
@@ -411,7 +411,7 @@ LLConstant* DtoGEPi(LLConstant* ptr, unsigned i0, unsigned i1)
//////////////////////////////////////////////////////////////////////////////////////////
void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
void DtoMemSet(LLValue* dst, LLValue* val, LLValue* nbytes)
{
dst = DtoBitCast(dst,getVoidPtrType());
@@ -419,7 +419,14 @@ void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
llvm::Function* fn = llvm::Intrinsic::getDeclaration(gIR->module,
llvm::Intrinsic::memset, &intTy, 1);
gIR->ir->CreateCall4(fn, dst, DtoConstUbyte(0), nbytes, DtoConstUint(0), "");
gIR->ir->CreateCall4(fn, dst, val, nbytes, DtoConstUint(0), "");
}
//////////////////////////////////////////////////////////////////////////////////////////
void DtoMemSetZero(LLValue* dst, LLValue* nbytes)
{
DtoMemSet(dst, DtoConstUbyte(0), nbytes);
}
//////////////////////////////////////////////////////////////////////////////////////////