From 00225dcc223cccbfe8d7ae5d1f35b843c1e55f73 Mon Sep 17 00:00:00 2001 From: NAKAMURA Takumi Date: Sun, 16 Aug 2015 02:41:23 +0000 Subject: [PATCH] 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 --- lib/Transforms/IPO/MergeFunctions.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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) { -- 2.34.1