From 481397b8980b9e4dc13f96c849d86dde6d21e707 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 8 Mar 2013 10:44:04 +0100 Subject: [PATCH] Fix liveness analysis. When a move has a temp that is either a scoped local or a formal, then instead of "returning" from the visit, the source expr still has to be visited. It might contain a use. Change-Id: Ibd54fdc3488b1348e63ecd5a0c1b1036ae111c8a Reviewed-by: Lars Knoll --- src/v4/qv4codegen.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/v4/qv4codegen.cpp b/src/v4/qv4codegen.cpp index 4cb2e0d..37a5f06 100644 --- a/src/v4/qv4codegen.cpp +++ b/src/v4/qv4codegen.cpp @@ -135,14 +135,17 @@ struct ComputeUseDef: IR::StmtVisitor, IR::ExprVisitor virtual void visitMove(IR::Move *s) { if (IR::Temp *t = s->target->asTemp()) { - if (t->index < 0 || t->scope != 0) - return; - - if (! _stmt->d->defs.contains(t->index)) - _stmt->d->defs.append(t->index); + if (t->index >= 0 && t->scope == 0) // only collect unscoped locals and temps + if (! _stmt->d->defs.contains(t->index)) + _stmt->d->defs.append(t->index); } else { + // source was not a temp, but maybe a sub-expression has a temp + // (e.g. base expressions for subscripts/member-access), + // so visit it. s->target->accept(this); } + // whatever the target expr was, always visit the source expr to collect + // temps there. s->source->accept(this); } }; -- 2.7.4