X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=ast.c;h=87d34cedc84d83badf820f32ac492916138e8e56;hb=bbffdde2dc5503cc6da92b4e7291c5b5e139de98;hp=5c42a304e0fa1008eb72b1180e705133783adbe5;hpb=fe296de42f96780b4a3c7c2647775ec3d8a5e59d;p=xonotic%2Fgmqcc.git diff --git a/ast.c b/ast.c index 5c42a30..87d34ce 100644 --- a/ast.c +++ b/ast.c @@ -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; @@ -2934,9 +2941,13 @@ bool ast_loop_codegen(ast_loop *self, ast_function *func, bool lvalue, ir_value { ir_block *ontrue, *onfalse; if (bprecond) ontrue = bprecond; - else if (bbody) ontrue = bbody; + else ontrue = bbody; /* can never be null */ + + /* all of this is dead code else if (bincrement) ontrue = bincrement; else ontrue = bpostcond; + */ + onfalse = bout; if (self->post_not) { tmpblock = ontrue;