summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/GlobalMerge.cpp
diff options
context:
space:
mode:
authorFangrui Song <maskray@google.com>2019-04-23 14:51:27 +0000
committerFangrui Song <maskray@google.com>2019-04-23 14:51:27 +0000
commitefd94c56badf696ed7193f4a83c7a59f7dfbfc6e (patch)
tree63f7a8a57c367cf6ba845a80eda9177b62c516be /llvm/lib/CodeGen/GlobalMerge.cpp
parent99cf58339fceadee43ba3fdbf962a083cd5af6c4 (diff)
downloadbcm5719-llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.tar.gz
bcm5719-llvm-efd94c56badf696ed7193f4a83c7a59f7dfbfc6e.zip
Use llvm::stable_sort
While touching the code, simplify if feasible. llvm-svn: 358996
Diffstat (limited to 'llvm/lib/CodeGen/GlobalMerge.cpp')
-rw-r--r--llvm/lib/CodeGen/GlobalMerge.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/llvm/lib/CodeGen/GlobalMerge.cpp b/llvm/lib/CodeGen/GlobalMerge.cpp
index d4cc1dadb2e..09201c2e7ba 100644
--- a/llvm/lib/CodeGen/GlobalMerge.cpp
+++ b/llvm/lib/CodeGen/GlobalMerge.cpp
@@ -219,11 +219,11 @@ bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
Module &M, bool isConst, unsigned AddrSpace) const {
auto &DL = M.getDataLayout();
// FIXME: Find better heuristics
- std::stable_sort(Globals.begin(), Globals.end(),
- [&DL](const GlobalVariable *GV1, const GlobalVariable *GV2) {
- return DL.getTypeAllocSize(GV1->getValueType()) <
- DL.getTypeAllocSize(GV2->getValueType());
- });
+ llvm::stable_sort(
+ Globals, [&DL](const GlobalVariable *GV1, const GlobalVariable *GV2) {
+ return DL.getTypeAllocSize(GV1->getValueType()) <
+ DL.getTypeAllocSize(GV2->getValueType());
+ });
// If we want to just blindly group all globals together, do so.
if (!GlobalMergeGroupByUse) {
@@ -385,11 +385,11 @@ bool GlobalMerge::doMerge(SmallVectorImpl<GlobalVariable*> &Globals,
//
// Multiply that by the size of the set to give us a crude profitability
// metric.
- std::stable_sort(UsedGlobalSets.begin(), UsedGlobalSets.end(),
- [](const UsedGlobalSet &UGS1, const UsedGlobalSet &UGS2) {
- return UGS1.Globals.count() * UGS1.UsageCount <
- UGS2.Globals.count() * UGS2.UsageCount;
- });
+ llvm::stable_sort(UsedGlobalSets,
+ [](const UsedGlobalSet &UGS1, const UsedGlobalSet &UGS2) {
+ return UGS1.Globals.count() * UGS1.UsageCount <
+ UGS2.Globals.count() * UGS2.UsageCount;
+ });
// We can choose to merge all globals together, but ignore globals never used
// with another global. This catches the obviously non-profitable cases of
OpenPOWER on IntegriCloud