aboutsummaryrefslogtreecommitdiffstats
path: root/src/qmlcompiler/qqmljsbasicblocks.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2022-04-05 14:09:17 +0200
committerUlf Hermann <ulf.hermann@qt.io>2022-04-06 17:12:50 +0200
commit8a229c38fb85d5b1e2d51dd87b27f4eb747e5f02 (patch)
treed890046ddca4a916bfd97977ef7c98253e69cf51 /src/qmlcompiler/qqmljsbasicblocks.cpp
parenta55299615ffbc50a2f0f0070015ed40e3b3dcca2 (diff)
QmlCompiler: Analyze type conversions before reads in basic blocks
The type conversions happen before the value is read. Therefore, we need to record them in this order. Otherwise, we may lose a type conversion if the instruction writes the same register as it reads. Fixes: QTBUG-102281 Change-Id: Id63a69f86af90c8dc987c0301db3958322c006a1 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qmlcompiler/qqmljsbasicblocks.cpp')
-rw-r--r--src/qmlcompiler/qqmljsbasicblocks.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/qmlcompiler/qqmljsbasicblocks.cpp b/src/qmlcompiler/qqmljsbasicblocks.cpp
index 6c3a0d71ab..67d3b978dd 100644
--- a/src/qmlcompiler/qqmljsbasicblocks.cpp
+++ b/src/qmlcompiler/qqmljsbasicblocks.cpp
@@ -296,6 +296,11 @@ void QQmlJSBasicBlocks::populateReaderLocations()
? (writeIt + 1)
: m_annotations.find(currentBlock->first);
for (; blockInstr != blockEnd; ++blockInstr) {
+ if (registerActive
+ && blockInstr->second.typeConversions.contains(writtenRegister)) {
+ conversions.append(blockInstr.key());
+ }
+
for (auto readIt = blockInstr->second.readRegisters.constBegin(),
end = blockInstr->second.readRegisters.constEnd();
readIt != end; ++readIt) {
@@ -309,11 +314,6 @@ void QQmlJSBasicBlocks::populateReaderLocations()
access.registerReadersAndConversions[blockInstr.key()] = conversions;
}
- if (registerActive
- && blockInstr->second.typeConversions.contains(writtenRegister)) {
- conversions.append(blockInstr.key());
- }
-
if (blockInstr->second.changedRegisterIndex == writtenRegister) {
conversions.clear();
registerActive = false;