From 4ed95774ed15f195da157c7c17a45e0c8c895054 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Tue, 12 Nov 2013 11:29:17 +0100 Subject: V4 JIT: fix invalid sanity assert. If there are multiple incoming edges to a block, and there are one or more phi nodes at the start, then only check the temp uses for the edge we are resolving. Task-number: QTBUG-34770 Change-Id: Ibb5c7c323d6be8bc1ed492b08ed098de2f2726cc Reviewed-by: Fawzi Mohamed Reviewed-by: Lars Knoll Reviewed-by: Mitch Curtis --- src/qml/compiler/qv4regalloc.cpp | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/qml/compiler/qv4regalloc.cpp b/src/qml/compiler/qv4regalloc.cpp index f746902814..9d1f12ec47 100644 --- a/src/qml/compiler/qv4regalloc.cpp +++ b/src/qml/compiler/qv4regalloc.cpp @@ -886,8 +886,28 @@ private: #if !defined(QT_NO_DEBUG) if (_info->def(it.temp()) != successorStart && !it.isSplitFromInterval()) { const int successorEnd = successor->statements.last()->id; - foreach (const Use &use, _info->uses(it.temp())) - Q_ASSERT(use.pos < static_cast(successorStart) || use.pos > static_cast(successorEnd)); + const int idx = successor->in.indexOf(predecessor); + foreach (const Use &use, _info->uses(it.temp())) { + if (use.pos == static_cast(successorStart)) { + // only check the current edge, not all other possible ones. This is + // important for phi nodes: they have uses that are only valid when + // coming in over a specific edge. + foreach (Stmt *s, successor->statements) { + if (Phi *phi = s->asPhi()) { + Q_ASSERT(it.temp().index != phi->targetTemp->index); + Q_ASSERT(phi->d->incoming[idx]->asTemp() == 0 + || it.temp().index != phi->d->incoming[idx]->asTemp()->index); + } else { + // TODO: check that the first non-phi statement does not use + // the temp. + break; + } + } + } else { + Q_ASSERT(use.pos < static_cast(successorStart) || + use.pos > static_cast(successorEnd)); + } + } } #endif -- cgit v1.2.3