]> git.xonotic.org Git - xonotic/gmqcc.git/blobdiff - ast.c
add instruction
[xonotic/gmqcc.git] / ast.c
diff --git a/ast.c b/ast.c
index a23aa75667710d23f7268ee565a9aa9a30c52150..bb15b3570ec68f8b2d2b797e3c796890941af9c1 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1185,7 +1185,7 @@ ast_function* ast_function_new(lex_ctx ctx, const char *name, ast_value *vtype)
     self->return_value     = NULL;
 
     return self;
-    
+
 cleanup:
     mem_d(self);
     return NULL;
@@ -2883,9 +2883,13 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value
     /* Now all blocks are in place */
     /* From 'bin' we jump to whatever comes first */
     if      (bprecond)   tmpblock = bprecond;
-    else if (bbody)      tmpblock = bbody;
+    else                 tmpblock = bbody;    /* can never be null */
+
+    /* DEAD CODE
     else if (bpostcond)  tmpblock = bpostcond;
     else                 tmpblock = bout;
+    */
+
     if (!ir_block_create_jump(bin, ast_ctx(self), tmpblock))
         return false;
 
@@ -2893,10 +2897,13 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value
     if (bprecond)
     {
         ir_block *ontrue, *onfalse;
-        if      (bbody)      ontrue = bbody;
+        ontrue = bbody; /* can never be null */
+
+        /* all of this is dead code
         else if (bincrement) ontrue = bincrement;
-        else if (bpostcond)  ontrue = bpostcond;
-        else                 ontrue = bprecond;
+        else                 ontrue = bpostcond;
+        */
+
         onfalse = bout;
         if (self->pre_not) {
             tmpblock = ontrue;
@@ -2936,7 +2943,7 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value
         if      (bprecond)   ontrue = bprecond;
         else                 ontrue = bbody; /* can never be null */
 
-        /* all of this is dead code 
+        /* all of this is dead code
         else if (bincrement) ontrue = bincrement;
         else                 ontrue = bpostcond;
         */