From d14a869c198400c45b2e6d2f8c0bc4101094c9c7 Mon Sep 17 00:00:00 2001 From: David Nadlinger Date: Sat, 10 Nov 2012 20:15:12 +0100 Subject: [PATCH] Only emit a single bitcast for struct literal padding. Mostly a cosmetic change. --- gen/toir.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gen/toir.cpp b/gen/toir.cpp index edd7f2d4..ec95d896 100644 --- a/gen/toir.cpp +++ b/gen/toir.cpp @@ -2935,6 +2935,7 @@ DValue* StructLiteralExp::toElem(IRState* p) size_t nexprs = elements->dim; Expression** exprs = (Expression**)elements->data; + // might be reset to an actual i8* value so only a single bitcast is emitted. LLValue* voidptr = mem; unsigned offset = 0; @@ -3022,7 +3023,7 @@ DValue* StructLiteralExp::toElem(IRState* p) } // initialize trailing padding if (sd->structsize != offset) - write_zeroes(voidptr, offset, sd->structsize); + voidptr = write_zeroes(voidptr, offset, sd->structsize); // return as a var return new DVarValue(type, mem);