diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-02-17 11:03:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2016-02-17 11:03:27 +0900 |
| commit | 819c9da8d2b37ed85a4a9213e5d596df5f1e4708 (patch) | |
| tree | 6c1bcfc6c9947eb809ec3cf37cebde66b8699483 | |
| parent | d8fc09cf927aad33138b54bc79d286ac0636cc06 (diff) | |
| download | mruby-819c9da8d2b37ed85a4a9213e5d596df5f1e4708.tar.gz mruby-819c9da8d2b37ed85a4a9213e5d596df5f1e4708.zip | |
peephole optimization for LOADNIL before STRCAT; ref #3110
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 12f79b893..52611c19e 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -339,6 +339,12 @@ genop_peep(codegen_scope *s, mrb_code i, int val) return 0; } } + if (c0 == OP_LOADNIL) { + if (GETARG_B(i) == GETARG_A(i0)) { + s->pc--; + return 0; + } + } break; case OP_JMPIF: case OP_JMPNOT: |
