From: NAKAMURA Takumi Date: Sun, 16 Aug 2015 02:41:23 +0000 (+0000) Subject: MergeFunc: Quick fix for r245140, Ignore second, aka Function*, in sorting. X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=00225dcc223cccbfe8d7ae5d1f35b843c1e55f73;p=oota-llvm.git 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 --- diff --git a/lib/Transforms/IPO/MergeFunctions.cpp b/lib/Transforms/IPO/MergeFunctions.cpp index 1c9d2170f92..67d6b7fcb67 100644 --- a/lib/Transforms/IPO/MergeFunctions.cpp +++ b/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 &a, + const std::pair &b) { + return a.first < b.first; + }); auto S = HashedFuncs.begin(); for (auto I = HashedFuncs.begin(), IE = HashedFuncs.end(); I != IE; ++I) {