From 13bcb5c5b16b9c9b34fcdd2ad4f2acf6151d14ab Mon Sep 17 00:00:00 2001 From: Dale Weiler Date: Fri, 26 Mar 2021 18:57:31 -0400 Subject: [PATCH] set m_op as well when doing a-(-b) => a+b peephole --- ast.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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]; } -- 2.39.2