summaryrefslogtreecommitdiff
path: root/src/passes/CoalesceLocals.cpp
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2016-09-14 20:31:20 -0700
committerAlon Zakai <alonzakai@gmail.com>2016-09-14 20:31:20 -0700
commit76a621f50b579e24f4210c1e2d35a9b3f72b0f94 (patch)
tree4671a95131893899d9bfcb6f97fec208c4e50c4f /src/passes/CoalesceLocals.cpp
parent77be43eb794dd0268fbf8298639ca2f717ef0663 (diff)
downloadbinaryen-76a621f50b579e24f4210c1e2d35a9b3f72b0f94.tar.gz
binaryen-76a621f50b579e24f4210c1e2d35a9b3f72b0f94.tar.bz2
binaryen-76a621f50b579e24f4210c1e2d35a9b3f72b0f94.zip
coalesce-locals code cleanup
Diffstat (limited to 'src/passes/CoalesceLocals.cpp')
-rw-r--r--src/passes/CoalesceLocals.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/passes/CoalesceLocals.cpp b/src/passes/CoalesceLocals.cpp
index 46885058f..503b7ad2a 100644
--- a/src/passes/CoalesceLocals.cpp
+++ b/src/passes/CoalesceLocals.cpp
@@ -438,13 +438,13 @@ void CoalesceLocals::pickIndicesFromOrder(std::vector<Index>& order, std::vector
indices.resize(numLocals);
types.resize(numLocals);
newInterferences.resize(numLocals * numLocals);
- newCopies.resize(numLocals * numLocals);
std::fill(newInterferences.begin(), newInterferences.end(), 0);
+ auto numParams = getFunction()->getNumParams();
+ newCopies.resize(numLocals * numLocals);
std::fill(newCopies.begin(), newCopies.end(), 0);
Index nextFree = 0;
removedCopies = 0;
// we can't reorder parameters, they are fixed in order, and cannot coalesce
- auto numParams = getFunction()->getNumParams();
Index i = 0;
for (; i < numParams; i++) {
assert(order[i] == i); // order must leave the params in place
@@ -475,7 +475,7 @@ void CoalesceLocals::pickIndicesFromOrder(std::vector<Index>& order, std::vector
indices[actual] = found = nextFree;
types[found] = getFunction()->getLocalType(actual);
nextFree++;
- removedCopies += newCopies[found * numLocals + actual];
+ removedCopies += getCopies(found, actual);
} else {
removedCopies += foundCopies;
}