diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-26 14:45:41 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-08-26 14:45:41 +0000 |
commit | 235e64c2474d40789d39306dda1cc415310a50b0 (patch) | |
tree | c0ca6d8ca7ed55b0568f1d542fe392882c2c135f | |
parent | 5586497bc552d6e712edd70f92baceec42fcd6ee (diff) |
merge revision(s) a6a26e42b15c46f117f4fce07a2050e9d727355d: [Backport #15906]
compile.c: Partially revert r63870 which caused wrong optimization
[Bug #15906]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_5@67757 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | compile.c | 3 | ||||
-rw-r--r-- | test/ruby/test_optimization.rb | 15 | ||||
-rw-r--r-- | version.h | 2 |
3 files changed, 18 insertions, 2 deletions
@@ -2513,7 +2513,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal ELEM_INSERT_NEXT(&iobj->link, &pop->link); goto again; } - else if ((piobj = (INSN *)get_prev_insn(iobj)) != 0 && + else if (IS_INSN(iobj->link.prev) && + (piobj = (INSN *)iobj->link.prev) && (IS_INSN_ID(piobj, branchif) || IS_INSN_ID(piobj, branchunless))) { INSN *pdiobj = (INSN *)get_destination_insn(piobj); diff --git a/test/ruby/test_optimization.rb b/test/ruby/test_optimization.rb index 983054eafc..2a4cc19699 100644 --- a/test/ruby/test_optimization.rb +++ b/test/ruby/test_optimization.rb @@ -755,6 +755,21 @@ class TestRubyOptimization < Test::Unit::TestCase assert_equal(:ok, x.bug(:ok)) end + def test_jump_elimination_with_optimized_out_block_2 + x = Object.new + def x.bug + a = "aaa" + ok = :NG + if a == "bbb" || a == "ccc" then + a = a + else + ok = :ok + end + ok + end + assert_equal(:ok, x.bug) + end + def test_peephole_jump_after_newarray i = 0 %w(1) || 2 while (i += 1) < 100 @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.5.6" #define RUBY_RELEASE_DATE "2019-08-26" -#define RUBY_PATCHLEVEL 176 +#define RUBY_PATCHLEVEL 177 #define RUBY_RELEASE_YEAR 2019 #define RUBY_RELEASE_MONTH 8 |