aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/compiler/qv4ssa.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index 31e3ed867e..d2222a0458 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -2991,7 +2991,19 @@ void splitCriticalEdges(IR::Function *f, DominatorTree &df, StatementWorklist &w
toBB->in[inIdx] = newBB;
newBB->out.append(toBB);
- newBB->setContainingGroup(toBB->containingGroup());
+ // add newBB to the correct loop group
+ if (toBB->isGroupStart()) {
+ BasicBlock *container;
+ for (container = fromBB->containingGroup(); container; container = container->containingGroup())
+ if (container == toBB)
+ break;
+ if (container == toBB) // if we were already inside the toBB loop
+ newBB->setContainingGroup(toBB);
+ else
+ newBB->setContainingGroup(toBB->containingGroup());
+ } else {
+ newBB->setContainingGroup(toBB->containingGroup());
+ }
// patch the terminator
Stmt *terminator = fromBB->terminator();