summaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-09 15:13:55 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-09 15:13:55 +0000
commitc4a34e5ceeb6ce5231ec82a0162f03aac139cf81 (patch)
tree517516485579503aa40d3e9af95eba528f9fdb2e /compile.c
parent8ef9767608128b5f9c14adfa0a877bd25be6b11f (diff)
merge revision(s) 58398: [Backport #13444]
compile.c: wrong optimization * compile.c (compile_branch_condition): expression which has side effects should not be eliminated. [ruby-core:80740] [Bug #13444] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@58634 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c12
1 files changed, 1 insertions, 11 deletions
diff --git a/compile.c b/compile.c
index 1c2618c822..67ae07064d 100644
--- a/compile.c
+++ b/compile.c
@@ -2216,7 +2216,7 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
OPERAND_AT(pobj, 0) == Qfalse :
FALSE);
}
- else if (IS_INSN_ID(pobj, putstring)) {
+ else if (IS_INSN_ID(pobj, putstring) || IS_INSN_ID(pobj, duparray)) {
cond = IS_INSN_ID(iobj, branchif);
}
else if (IS_INSN_ID(pobj, putnil)) {
@@ -2874,18 +2874,8 @@ compile_branch_condition(rb_iseq_t *iseq, LINK_ANCHOR *const ret, NODE *cond,
case NODE_LIT: /* NODE_LIT is always not true */
case NODE_TRUE:
case NODE_STR:
- case NODE_DSTR:
- case NODE_XSTR:
- case NODE_DXSTR:
- case NODE_DREGX:
- case NODE_DREGX_ONCE:
- case NODE_DSYM:
- case NODE_ARRAY:
case NODE_ZARRAY:
- case NODE_HASH:
case NODE_LAMBDA:
- case NODE_DEFN:
- case NODE_DEFS:
/* printf("useless condition eliminate (%s)\n", ruby_node_name(nd_type(cond))); */
ADD_INSNL(ret, nd_line(cond), jump, then_label);
break;