MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.

Don't assume second would be ordered in the module.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@245168 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
NAKAMURA Takumi 2015-08-16 02:41:23 +00:00
parent c118a5970b
commit 00225dcc22

View File

@ -1316,7 +1316,12 @@ bool MergeFunctions::runOnModule(Module &M) {
}
}
std::sort(HashedFuncs.begin(), HashedFuncs.end());
std::stable_sort(
HashedFuncs.begin(), HashedFuncs.end(),
[](const std::pair<FunctionComparator::FunctionHash, Function *> &a,
const std::pair<FunctionComparator::FunctionHash, Function *> &b) {
return a.first < b.first;
});
auto S = HashedFuncs.begin();
for (auto I = HashedFuncs.begin(), IE = HashedFuncs.end(); I != IE; ++I) {