Change peep() to optimise away unneeded rv2av in lval->[] and lval->{}
Malcolm Beattie [Wed, 29 Oct 1997 12:45:02 +0000 (12:45 +0000)]
p4raw-id: //depot/perl@187

op.c

diff --git a/op.c b/op.c
index f9449f5..e7d843d 100644 (file)
--- a/op.c
+++ b/op.c
@@ -4886,6 +4886,24 @@ register OP* o;
            o->op_seq = op_seqmax++;
            break;
 
+       case OP_PADAV:
+           if (o->op_next->op_type == OP_RV2AV
+               && (o->op_next->op_flags && OPf_REF))
+           {
+               null(o->op_next);
+               o->op_next = o->op_next->op_next;
+           }
+           break;
+           
+       case OP_PADHV:
+           if (o->op_next->op_type == OP_RV2HV
+               && (o->op_next->op_flags && OPf_REF))
+           {
+               null(o->op_next);
+               o->op_next = o->op_next->op_next;
+           }
+           break;
+
        case OP_MAPWHILE:
        case OP_GREPWHILE:
        case OP_AND: