mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-09-29 16:50:19 +02:00
Do not unnecessarily call postblit after rvalue array initializers.
Fixes DMD testcases 'sdtor' and 'structlit'.
This commit is contained in:
+13
-2
@@ -623,8 +623,16 @@ DValue* AssignExp::toElem(IRState* p)
|
||||
return r;
|
||||
}
|
||||
|
||||
Logger::println("performing normal assignment");
|
||||
DtoAssign(loc, l, r, op);
|
||||
bool canSkipPostblit = false;
|
||||
if (!(e2->op == TOKslice && ((UnaExp *)e2)->e1->isLvalue()) &&
|
||||
!(e2->op == TOKcast && ((UnaExp *)e2)->e1->isLvalue()) &&
|
||||
(e2->op == TOKslice || !e2->isLvalue()))
|
||||
{
|
||||
canSkipPostblit = true;
|
||||
}
|
||||
|
||||
Logger::println("performing normal assignment (canSkipPostblit = %d)", canSkipPostblit);
|
||||
DtoAssign(loc, l, r, op, canSkipPostblit);
|
||||
|
||||
if (l->isSlice())
|
||||
return l;
|
||||
@@ -2983,6 +2991,9 @@ DValue* StructLiteralExp::toElem(IRState* p)
|
||||
// store the initializer there
|
||||
DtoAssign(loc, &field, val, TOKconstruct);
|
||||
|
||||
if (expr)
|
||||
callPostblit(loc, expr, field.getLVal());
|
||||
|
||||
// Also zero out padding bytes counted as being part of the type in DMD
|
||||
// but not in LLVM; e.g. real/x86_fp80.
|
||||
int implicitPadding =
|
||||
|
||||
Reference in New Issue
Block a user