]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
Don't generate IF/IFNOT with +1 offsets
authorWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 18 Dec 2012 11:57:09 +0000 (12:57 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Tue, 18 Dec 2012 11:57:09 +0000 (12:57 +0100)
ir.c

diff --git a/ir.c b/ir.c
index a2b6dcc140edf6acd11d5894f182253f606d969e..f5ad97e3cd2b7aea35da25f7743e5f0e082066c2 100644 (file)
--- a/ir.c
+++ b/ir.c
@@ -2712,12 +2712,14 @@ tailcall:
             if (ontrue->generated) {
                 stmt.opcode = INSTR_IF;
                 stmt.o2.s1 = (ontrue->code_start) - vec_size(code_statements);
-                code_push_statement(&stmt, instr->context.line);
+                if (stmt.o2.s1 != 1)
+                    code_push_statement(&stmt, instr->context.line);
             }
             if (onfalse->generated) {
                 stmt.opcode = INSTR_IFNOT;
                 stmt.o2.s1 = (onfalse->code_start) - vec_size(code_statements);
-                code_push_statement(&stmt, instr->context.line);
+                if (stmt.o2.s1 != 1)
+                    code_push_statement(&stmt, instr->context.line);
             }
             if (!ontrue->generated) {
                 if (onfalse->generated) {
@@ -2741,7 +2743,8 @@ tailcall:
                 ontrue = tmp;
             }
             stidx = vec_size(code_statements);
-            code_push_statement(&stmt, instr->context.line);
+            if (stmt.o2.s1 != 1)
+                code_push_statement(&stmt, instr->context.line);
             /* on false we jump, so add ontrue-path */
             if (!gen_blocks_recursive(func, ontrue))
                 return false;