]> git.rm.cloudns.org Git - xonotic/gmqcc.git/commitdiff
set m_op as well when doing a-(-b) => a+b peephole
authorDale Weiler <weilercdale@gmail.com>
Fri, 26 Mar 2021 22:57:31 +0000 (18:57 -0400)
committerDale Weiler <weilercdale@gmail.com>
Fri, 26 Mar 2021 22:57:31 +0000 (18:57 -0400)
ast.cpp

diff --git a/ast.cpp b/ast.cpp
index 7b444f8a402dfdf18efaab0ae3d171c1174972ae..6d3b28a11dca7536467d5481255f640ae32d0c68 100644 (file)
--- a/ast.cpp
+++ b/ast.cpp
@@ -301,11 +301,11 @@ ast_binary::ast_binary(lex_ctx_t ctx, int op,
         /* make a-(-b) => a + b */
         if (unary->m_op == VINSTR_NEG_F || unary->m_op == VINSTR_NEG_V) {
             if (op == INSTR_SUB_F) {
-                op = INSTR_ADD_F;
+                op = m_op = INSTR_ADD_F;
                 right = normal;
                 ++opts_optimizationcount[OPTIM_PEEPHOLE];
             } else if (op == INSTR_SUB_V) {
-                op = INSTR_ADD_V;
+                op = m_op = INSTR_ADD_V;
                 right = normal;
                 ++opts_optimizationcount[OPTIM_PEEPHOLE];
             }