aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-02-18 12:31:54 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-02-21 07:19:16 +0000
commit02f9fd8af162532aae8554382ea41e135931a146 (patch)
tree656805b311a586510637b7f8ea47641c4e843779 /src/qmlcompiler
parentcf284c869600d8b3d957f4a27bc7ba1dbf204f09 (diff)
QmlCompiler: Avoid infinite loop in dead store elimination
We have to mark the required variables also in block 0. And we shouldn't generate empty blocks. Fixes: QTBUG-101011 Change-Id: I0dd19f69f45f507cb83e2ddfba3060de48a940b4 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> (cherry picked from commit 88147eb3f621e7d972410698d6edca16493d7c66) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src/qmlcompiler')
-rw-r--r--src/qmlcompiler/qqmljscodegenerator.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/qmlcompiler/qqmljscodegenerator.cpp b/src/qmlcompiler/qqmljscodegenerator.cpp
index 93b69474db..d87b2a38ad 100644
--- a/src/qmlcompiler/qqmljscodegenerator.cpp
+++ b/src/qmlcompiler/qqmljscodegenerator.cpp
@@ -184,9 +184,11 @@ QList<QQmlJSCodeGenerator::BasicBlock> QQmlJSCodeGenerator::findBasicBlocks(
const QQmlJSCodeGenerator::Section &section = sections[i];
const QString label = section.label();
if (!label.isEmpty() || currentBlock.jumpMode != JumpMode::None) {
- currentBlock.endSection = i;
- basicBlocks.append(currentBlock);
- currentBlock.beginSection = i;
+ if (currentBlock.beginSection != i) {
+ currentBlock.endSection = i;
+ basicBlocks.append(currentBlock);
+ currentBlock.beginSection = i;
+ }
currentBlock.label = label;
}
currentBlock.jumpMode = section.jumpMode();
@@ -320,6 +322,7 @@ void QQmlJSCodeGenerator::eliminateDeadStores()
usedOnce = true;
}
}
+ requiredRegisters[0][variable] = inUse;
if (!usedOnce) {
registerTypeIt = registerTypes.erase(registerTypeIt);