diff options
author | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2017-02-24 09:42:12 -0500 |
---|---|---|
committer | Quentin Carbonneaux <quentin.carbonneaux@yale.edu> | 2017-02-24 09:50:28 -0500 |
commit | f3301026fa404c68c7ad399b5a56a5135b88af04 (patch) | |
tree | ffb3f425adac1780593526f90f095dfb97fc1b5c /mem.c | |
parent | fc124dd22e6d936de53c60f6752e45c857f10013 (diff) | |
download | roux-f3301026fa404c68c7ad399b5a56a5135b88af04.tar.gz |
reenable and fix a bug in memopt
While a minimal dead store elimination is not implemented, the generated code looks quite a bit better with them enabled. It also is quite cheap.
Diffstat (limited to 'mem.c')
-rw-r--r-- | mem.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/mem.c b/mem.c index ea0bef7..11527fa 100644 --- a/mem.c +++ b/mem.c @@ -86,15 +86,18 @@ memopt(Fn *fn) /* try to turn loads into copies so we * can eliminate them later */ switch(l->op) { - case Oload: case Oloadsw: case Oloaduw: + if (k == Kl) + goto Extend; + case Oload: if (KBASE(k) != KBASE(l->cls)) l->op = Ocast; else l->op = Ocopy; break; default: + Extend: l->op = Oextsb + (l->op - Oloadsb); break; } |