aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/compiler/qv4ssa.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qml/compiler/qv4ssa.cpp')
-rw-r--r--src/qml/compiler/qv4ssa.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/qml/compiler/qv4ssa.cpp b/src/qml/compiler/qv4ssa.cpp
index d67b88b718..d2222a0458 100644
--- a/src/qml/compiler/qv4ssa.cpp
+++ b/src/qml/compiler/qv4ssa.cpp
@@ -2991,15 +2991,19 @@ void splitCriticalEdges(IR::Function *f, DominatorTree &df, StatementWorklist &w
toBB->in[inIdx] = newBB;
newBB->out.append(toBB);
- BasicBlock *container = 0;
- for (container = fromBB->containingGroup(); container; container = container->containingGroup()) {
- if (container == toBB || container == toBB->containingGroup())
- break;
+ // 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());
}
- if (container == 0)
- container = fromBB->containingGroup();
-
- newBB->setContainingGroup(container);
// patch the terminator
Stmt *terminator = fromBB->terminator();