aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorDaniel Glöckner <daniel-gl@gmx.net>2008-09-11 19:15:57 +0200
committergrischka <grischka>2008-09-12 22:23:00 +0200
commit5a92536cea206c06a334b0162ca00af5f1356f43 (patch)
treed3cc8f4de021c16f5dac6b1bdf183faace001a44 /tcc.c
parente263ee3cbfcb700d652b785ba95fa9e81e2b2a6b (diff)
downloadtinycc-5a92536cea206c06a334b0162ca00af5f1356f43.tar.gz
tinycc-5a92536cea206c06a334b0162ca00af5f1356f43.tar.bz2
Optimize arithmetic with pointer to value on stack + constant
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/tcc.c b/tcc.c
index 8ed87af..98d8de6 100644
--- a/tcc.c
+++ b/tcc.c
@@ -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;