]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Don't copy return values away from OFS_RETURN if they don't get locked.
authorWolfgang Bumiller <blub@speed.at>
Wed, 26 Dec 2012 17:33:16 +0000 (18:33 +0100)
committerWolfgang Bumiller <blub@speed.at>
Wed, 26 Dec 2012 17:33:16 +0000 (18:33 +0100)
ir.c

diff --git a/ir.c b/ir.c
index ec87bd78cd7edde6dfc3ecf2fbba6fa0962bd6f1..54cec7ea3e0dd95625a1ffc92027c15080b9dbdf 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -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
          * and it's not "locked", write it to the OFS_PARM directly.
          */
-        if (OPTS_OPTIMIZATION(OPTIM_CALL_STORES)) {
-            if (!v->locked && vec_size(v->reads) == 1 && vec_size(v->writes) == 1 &&
+        if (OPTS_OPTIMIZATION(OPTIM_CALL_STORES) && !v->locked) {
+            if (vec_size(v->reads) == 1 && vec_size(v->writes) == 1 &&
                 (v->reads[0]->opcode == VINSTR_NRCALL ||
                  (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;
             }
+            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)