diff options
author | Alon Zakai <alonzakai@gmail.com> | 2016-05-05 11:47:54 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2016-05-05 11:47:54 -0700 |
commit | bb3dbb2784e91a517916f366e710e01a2e7331f6 (patch) | |
tree | 08ee1e92384235c2f830b65ba7a12c59689d1b88 /src/passes/ReorderLocals.cpp | |
parent | f85e310924535da09822f3d43aeee9265eb12760 (diff) | |
parent | bbf846554a407e0385f91f5b7eeb9594c12e0bc5 (diff) | |
download | binaryen-bb3dbb2784e91a517916f366e710e01a2e7331f6.tar.gz binaryen-bb3dbb2784e91a517916f366e710e01a2e7331f6.tar.bz2 binaryen-bb3dbb2784e91a517916f366e710e01a2e7331f6.zip |
Merge pull request #435 from WebAssembly/more-relooper
Add optimization to C API, and with that, more relooper tests
Diffstat (limited to 'src/passes/ReorderLocals.cpp')
-rw-r--r-- | src/passes/ReorderLocals.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/passes/ReorderLocals.cpp b/src/passes/ReorderLocals.cpp index 1a3fbf09a..0e626e0a2 100644 --- a/src/passes/ReorderLocals.cpp +++ b/src/passes/ReorderLocals.cpp @@ -106,8 +106,11 @@ struct ReorderLocals : public WalkerPass<PostWalker<ReorderLocals, Visitor<Reord curr->localNames.resize(newToOld.size()); curr->localIndices.clear(); for (size_t i = 0; i < newToOld.size(); i++) { - curr->localNames[i] = oldLocalNames[newToOld[i]]; - curr->localIndices[oldLocalNames[newToOld[i]]] = i; + if (newToOld[i] < oldLocalNames.size()) { + auto old = oldLocalNames[newToOld[i]]; + curr->localNames[i] = old; + curr->localIndices[old] = i; + } } } |