1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix a bug of peephole optimization

```
  if   L1
L0:
  jump L2
L1:
  ...
L2:
```

was wrongly optimized to:

```
  unless L2
L0:
L1:
  ...
L2:
```

To make it conservative, this optimization is now disabled when there is
any label between `if` and `jump` instructions.
Fixes [Bug #14897].

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63868 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2018-07-06 04:52:33 +00:00
parent fcf8c622fd
commit 727ceb2a95
2 changed files with 12 additions and 1 deletions

View file

@ -589,3 +589,13 @@ assert_equal "foo", %q{
end
Bug6460.new.m1
}, '[ruby-dev:46372]'
assert_equal "foo", %q{
obj = "foo"
if obj || any1
any2 = any2
else
raise obj.inspect
end
obj
}, '[ruby-core:87830]'