diff options
-rw-r--r-- | qbe.c | 7 | ||||
-rw-r--r-- | test/struct-return-2.qbe | 11 |
2 files changed, 7 insertions, 11 deletions
@@ -360,10 +360,7 @@ funcload(struct func *f, struct type *t, struct lvalue lval) case TYPESTRUCT: case TYPEUNION: case TYPEARRAY: - v = xmalloc(sizeof(*v)); - *v = *lval.addr; - v->repr = t->repr; - return v; + return lval.addr; default: assert(t->prop & PROPREAL); switch (t->size) { @@ -682,7 +679,7 @@ funclval(struct func *f, struct expr *e) default: if (e->type->kind != TYPESTRUCT && e->type->kind != TYPEUNION) error(&tok.loc, "expression is not an object"); - lval.addr = funcinst(f, ICOPY, &iptr, funcexpr(f, e), NULL); + lval.addr = funcexpr(f, e); } return lval; } diff --git a/test/struct-return-2.qbe b/test/struct-return-2.qbe index 415ec2f..3e5a544 100644 --- a/test/struct-return-2.qbe +++ b/test/struct-return-2.qbe @@ -5,10 +5,9 @@ function w $f() { @body.2 %.1 =:.1 call $g() %.2 =l copy %.1 - %.3 =l copy %.2 - %.4 =l mul 4, 1 - %.5 =l add %.3, %.4 - %.6 =l copy %.5 - %.7 =w loadsw %.6 - ret %.7 + %.3 =l mul 4, 1 + %.4 =l add %.2, %.3 + %.5 =l copy %.4 + %.6 =w loadsw %.5 + ret %.6 } |