[llvm] r245168 - MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.
NAKAMURA Takumi via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 15 19:41:25 PDT 2015
Author: chapuni
Date: Sat Aug 15 21:41:23 2015
New Revision: 245168
URL: http://llvm.org/viewvc/llvm-project?rev=245168&view=rev
Log:
MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.
Don't assume second would be ordered in the module.
Modified:
llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
Modified: llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp?rev=245168&r1=245167&r2=245168&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/MergeFunctions.cpp Sat Aug 15 21:41:23 2015
@@ -1316,7 +1316,12 @@ bool MergeFunctions::runOnModule(Module
}
}
- 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) {
More information about the llvm-commits
mailing list