[WebAssembly] Use stable sort when sorting ctore functions

Patch by Nicholas Wilson!

llvm-svn: 325656
This commit is contained in:
Sam Clegg 2018-02-21 00:34:34 +00:00
parent 94a940d2b4
commit 29b8feb615
1 changed files with 4 additions and 4 deletions

View File

@ -871,10 +871,10 @@ void Writer::calculateInitFunctions() {
}
// Sort in order of priority (lowest first) so that they are called
// in the correct order.
std::sort(InitFunctions.begin(), InitFunctions.end(),
[](const WasmInitFunc &L, const WasmInitFunc &R) {
return L.Priority < R.Priority;
});
std::stable_sort(InitFunctions.begin(), InitFunctions.end(),
[](const WasmInitFunc &L, const WasmInitFunc &R) {
return L.Priority < R.Priority;
});
}
void Writer::run() {