diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-10-23 14:14:26 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-10-23 14:14:26 +0900 |
| commit | 09376f9b2a6ce2c56f5a4fc7abb88ea4e68c59e3 (patch) | |
| tree | 33d73ed77ae710d47ded6bed44d619977ddb2762 /src/codegen.c | |
| parent | 413528ce803135dd63423047accaea142c283fcd (diff) | |
| download | mruby-09376f9b2a6ce2c56f5a4fc7abb88ea4e68c59e3.tar.gz mruby-09376f9b2a6ce2c56f5a4fc7abb88ea4e68c59e3.zip | |
skip useless OP_MOVE in peephole optimization
Diffstat (limited to 'src/codegen.c')
| -rw-r--r-- | src/codegen.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/codegen.c b/src/codegen.c index df5bc2acf..b0e6f8fd1 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -170,6 +170,10 @@ genop_peep(codegen_scope *s, mrb_code i, int val) switch (c1) { case OP_MOVE: + if (GETARG_A(i) == GETARG_B(i)) { + /* skip useless OP_MOVE */ + return; + } if (val) break; switch (c0) { case OP_MOVE: |
