aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/IPO/MergeFunctions.cpp
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2015-08-16 02:41:23 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2015-08-16 02:41:23 +0000
commit5196275eeab605a62060ed07c66bb6d49a767a62 (patch)
tree8d89f778856e09dda42dab491f443ec32eb68aa3 /llvm/lib/Transforms/IPO/MergeFunctions.cpp
parentdfb655fe1730e62a51b4cfb24e7511393083e4d3 (diff)
downloadllvm-5196275eeab605a62060ed07c66bb6d49a767a62.zip
llvm-5196275eeab605a62060ed07c66bb6d49a767a62.tar.gz
llvm-5196275eeab605a62060ed07c66bb6d49a767a62.tar.bz2
MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting.
Don't assume second would be ordered in the module. llvm-svn: 245168
Diffstat (limited to 'llvm/lib/Transforms/IPO/MergeFunctions.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/MergeFunctions.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index 1c9d217..67d6b7f 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -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) {