From: Dale Weiler Date: Fri, 26 Mar 2021 22:57:31 +0000 (-0400) Subject: set m_op as well when doing a-(-b) => a+b peephole X-Git-Tag: xonotic-v0.8.5~9 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=13bcb5c5b16b9c9b34fcdd2ad4f2acf6151d14ab;p=xonotic%2Fgmqcc.git set m_op as well when doing a-(-b) => a+b peephole --- diff --git a/ast.cpp b/ast.cpp index 7b444f8..6d3b28a 100644 --- 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]; }