summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-07-17 15:31:49 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-07-17 15:31:49 -0700
commit4a6e828989ab6f627e6b35c66bd8c6130c9d65e2 (patch)
treed1554fa16e241dcf171989c31da65a827a2d43b4
parent6fab89853edd16f2a0e1d31e753c6339cda751a5 (diff)
downloadbinaryen-4a6e828989ab6f627e6b35c66bd8c6130c9d65e2.tar.gz
binaryen-4a6e828989ab6f627e6b35c66bd8c6130c9d65e2.tar.bz2
binaryen-4a6e828989ab6f627e6b35c66bd8c6130c9d65e2.zip
optimize updating of interference and copy table in CoalesceLocals
-rw-r--r--src/passes/CoalesceLocals.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/passes/CoalesceLocals.cpp b/src/passes/CoalesceLocals.cpp
index 75db26800..2c707b614 100644
--- a/src/passes/CoalesceLocals.cpp
+++ b/src/passes/CoalesceLocals.cpp
@@ -408,7 +408,7 @@ void CoalesceLocals::pickIndicesFromOrder(std::vector<Index>& order, std::vector
assert(order[i] == i); // order must leave the params in place
indices[i] = i;
types[i] = getFunction()->getLocalType(i);
- for (Index j = 0; j < numLocals; j++) {
+ for (Index j = numParams; j < numLocals; j++) {
newInterferences[numLocals * i + j] = interferes(i, j);
newCopies[numLocals * i + j] = getCopies(i, j);
}
@@ -434,7 +434,8 @@ void CoalesceLocals::pickIndicesFromOrder(std::vector<Index>& order, std::vector
nextFree++;
}
// merge new interferences and copies for the new index
- for (Index j = 0; j < numLocals; j++) {
+ for (Index k = i + 1; k < numLocals; k++) {
+ auto j = order[k]; // go in the order, we only need to update for those we will see later
newInterferences[found * numLocals + j] = newInterferences[found * numLocals + j] | interferes(actual, j);
newCopies[found * numLocals + j] += getCopies(actual, j);
}