Don't copy return values away from OFS_RETURN if they don't get locked.

This commit is contained in:
Wolfgang Bumiller 2012-12-26 18:33:16 +01:00
parent 456e80a7d5
commit 14889897da

9
ir.c
View file

@ -2195,8 +2195,8 @@ bool ir_function_allocate_locals(ir_function *self)
* If the value is a parameter-temp: 1 write, 1 read from a CALL * If the value is a parameter-temp: 1 write, 1 read from a CALL
* and it's not "locked", write it to the OFS_PARM directly. * and it's not "locked", write it to the OFS_PARM directly.
*/ */
if (OPTS_OPTIMIZATION(OPTIM_CALL_STORES)) { if (OPTS_OPTIMIZATION(OPTIM_CALL_STORES) && !v->locked) {
if (!v->locked && vec_size(v->reads) == 1 && vec_size(v->writes) == 1 && if (vec_size(v->reads) == 1 && vec_size(v->writes) == 1 &&
(v->reads[0]->opcode == VINSTR_NRCALL || (v->reads[0]->opcode == VINSTR_NRCALL ||
(v->reads[0]->opcode >= INSTR_CALL0 && v->reads[0]->opcode <= INSTR_CALL8) (v->reads[0]->opcode >= INSTR_CALL0 && v->reads[0]->opcode <= INSTR_CALL8)
) )
@ -2224,6 +2224,11 @@ bool ir_function_allocate_locals(ir_function *self)
} }
continue; continue;
} }
if (vec_size(v->writes) == 1 && v->writes[0]->opcode == INSTR_CALL0)
{
v->store = store_return;
continue;
}
} }
for (a = 0; a < vec_size(alloc.locals); ++a) for (a = 0; a < vec_size(alloc.locals); ++a)