Optimize arithmetic with pointer to value on stack + constant

tcc-xref
Daniel Glöckner 2008-09-11 19:15:57 +02:00 committed by grischka
parent e263ee3cbf
commit 5a92536cea
1 changed files with 3 additions and 2 deletions

5
tcc.c
View File

@ -5596,8 +5596,9 @@ void gen_opic(int op)
}
goto general_case;
} else if (c2 && (op == '+' || op == '-') &&
(vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) ==
(VT_CONST | VT_SYM)) {
((vtop[-1].r & (VT_VALMASK | VT_LVAL | VT_SYM)) ==
(VT_CONST | VT_SYM) ||
(vtop[-1].r & (VT_VALMASK | VT_LVAL)) == VT_LOCAL)) {
/* symbol + constant case */
if (op == '-')
l2 = -l2;