# HG changeset patch # User ChristianK # Date 1216028823 -7200 # Node ID ac654d4cb935e9539ee7c9dce118ac712aa5c794 # Parent a7a26f538d6e749e8655817791061e3ac15da903 [svn r375] Make DeclarationExp reuse storage if already allocated. diff -r a7a26f538d6e -r ac654d4cb935 gen/toir.cpp --- a/gen/toir.cpp Mon Jul 14 11:07:15 2008 +0200 +++ b/gen/toir.cpp Mon Jul 14 11:47:03 2008 +0200 @@ -69,9 +69,8 @@ assert(vd->ir.irLocal->value); assert(vd->ir.irLocal->nestedIndex >= 0); } - // normal stack variable - else { - // allocate storage on the stack + // normal stack variable, allocate storage on the stack if it has not already been done + else if(!vd->ir.irLocal) { const LLType* lltype = DtoType(vd->type); llvm::Value* allocainst; @@ -81,7 +80,6 @@ allocainst = new llvm::AllocaInst(lltype, vd->toChars(), p->topallocapoint()); //allocainst->setAlignment(vd->type->alignsize()); // TODO - assert(!vd->ir.irLocal); vd->ir.irLocal = new IrLocal(vd); vd->ir.irLocal->value = allocainst;