Avoid unnecessary memset when allocating array literals.

This completes the merge of pull request #294. Thanks a lot to
Chris Holdsworth who originally wrote the patch!

GitHub: Fixes #294.
GitHub: Fixes #141.
This commit is contained in:
David Nadlinger 2013-05-04 21:20:09 +02:00
parent f2662c3660
commit 0a376b9c71
3 changed files with 7 additions and 2 deletions

View file

@ -583,7 +583,9 @@ DSliceValue* DtoNewDynArray(Loc& loc, Type* arrayType, DValue* dim, bool default
defaultInit = false;
bool zeroInit = eltType->isZeroInit();
const char* fnname = zeroInit ? "_d_newarrayT" : "_d_newarrayiT";
const char* fnname = defaultInit ?
(zeroInit ? "_d_newarrayT" : "_d_newarrayiT") :
"_d_newarrayvT";
LLFunction* fn = LLVM_D_GetRuntimeFunction(gIR->module, fnname);
// call allocator