]> git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
Tiny codegen optimization: silently ignore the creation of STORE with input and outpu...
authorWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 5 Dec 2012 14:17:11 +0000 (15:17 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Wed, 5 Dec 2012 14:17:11 +0000 (15:17 +0100)
ir.c

diff --git a/ir.c b/ir.c
index 890ea0ff8c10c1cf93a58b67ceb9a1f4c41c4b68..ed58ea950786caa340bba810582f51215dd44249 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -2832,6 +2832,16 @@ tailcall:
             /* 2-operand instructions with A -> B */
             stmt.o2.u1 = stmt.o3.u1;
             stmt.o3.u1 = 0;
+
+            /* tiny optimization, don't output
+             * STORE a, a
+             */
+            if (stmt.o2.u1 == stmt.o1.u1 &&
+                OPTS_OPTIMIZATION(OPTIM_MINOR))
+            {
+                ++optimization_count[OPTIM_MINOR];
+                continue;
+            }
         }
 
         code_push_statement(&stmt, instr->context.line);