summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorAlan Wu <[email protected]>2021-05-06 18:54:52 -0400
committerAlan Wu <[email protected]>2021-05-28 12:34:03 -0400
commit788d30a8b388cd5500862a4015537203ef49ea85 (patch)
tree7a90c542b56382b60efcf18846e04a9c1a33f55f /compile.c
parent12214b7814220389f2e1e32421699bb54f834158 (diff)
Make range literal peephole optimization target "newrange"
It looks for "checkmatch", when it could be applied to anything that has "newrange". Making the optimization target more ranges might only be fair play when all ranges are frozen. So I'm putting a reference to the ticket that froze all ranges. [Feature #15504]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/4468
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/compile.c b/compile.c
index 44fb53cefd..e8d5d0514f 100644
--- a/compile.c
+++ b/compile.c
@@ -3027,13 +3027,12 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
*
* putobject "beg".."end"
*/
- if (IS_INSN_ID(iobj, checkmatch)) {
- INSN *range = (INSN *)get_prev_insn(iobj);
+ if (IS_INSN_ID(iobj, newrange)) {
+ INSN *const range = iobj;
INSN *beg, *end;
VALUE str_beg, str_end;
- if (range && IS_INSN_ID(range, newrange) &&
- (end = (INSN *)get_prev_insn(range)) != 0 &&
+ if ((end = (INSN *)get_prev_insn(range)) != 0 &&
is_frozen_putstring(end, &str_end) &&
(beg = (INSN *)get_prev_insn(end)) != 0 &&
is_frozen_putstring(beg, &str_beg)) {