This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Optimise %hash in sub { %hash || ... }
[perl5.git] / op.c
diff --git a/op.c b/op.c
index dd61cff..c62e943 100644 (file)
--- a/op.c
+++ b/op.c
@@ -10580,6 +10580,11 @@ Perl_rpeep(pTHX_ register OP *o)
                       || o->op_type == OP_AND  )
                    && fopishv)
                         cLOGOP->op_first = opt_scalarhv(fop);
+                else if (!(lop->op_flags & OPf_WANT)) {
+                    if (fop->op_type == OP_SCALAR)
+                        fop = cUNOPx(fop)->op_first;
+                    fop->op_private |= OpMAYBE_TRUEBOOL;
+                }
                 if (  (lop->op_flags & OPf_WANT) == OPf_WANT_VOID
                    && sopishv)
                         cLOGOP->op_first->op_sibling = opt_scalarhv(sop);