diff options
| author | Fangrui Song <maskray@google.com> | 2019-04-23 14:51:27 +0000 | 
|---|---|---|
| committer | Fangrui Song <maskray@google.com> | 2019-04-23 14:51:27 +0000 | 
| commit | efd94c56badf696ed7193f4a83c7a59f7dfbfc6e (patch) | |
| tree | 63f7a8a57c367cf6ba845a80eda9177b62c516be /llvm/lib/IR | |
| parent | 99cf58339fceadee43ba3fdbf962a083cd5af6c4 (diff) | |
| download | bcm5719-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/IR')
| -rw-r--r-- | llvm/lib/IR/MDBuilder.cpp | 4 | ||||
| -rw-r--r-- | llvm/lib/IR/Metadata.cpp | 5 | 
2 files changed, 2 insertions, 7 deletions
| diff --git a/llvm/lib/IR/MDBuilder.cpp b/llvm/lib/IR/MDBuilder.cpp index f65ac31ca5a..14bcb3a29b0 100644 --- a/llvm/lib/IR/MDBuilder.cpp +++ b/llvm/lib/IR/MDBuilder.cpp @@ -68,9 +68,7 @@ MDNode *MDBuilder::createFunctionEntryCount(    Ops.push_back(createConstant(ConstantInt::get(Int64Ty, Count)));    if (Imports) {      SmallVector<GlobalValue::GUID, 2> OrderID(Imports->begin(), Imports->end()); -    std::stable_sort(OrderID.begin(), OrderID.end(), -      [] (GlobalValue::GUID A, GlobalValue::GUID B) { -        return A < B;}); +    llvm::stable_sort(OrderID);      for (auto ID : OrderID)        Ops.push_back(createConstant(ConstantInt::get(Int64Ty, ID)));    } diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp index 70ffa652bfb..748a2238e64 100644 --- a/llvm/lib/IR/Metadata.cpp +++ b/llvm/lib/IR/Metadata.cpp @@ -1179,10 +1179,7 @@ void MDGlobalAttachmentMap::getAll(    // Sort the resulting array so it is stable with respect to metadata IDs. We    // need to preserve the original insertion order though. -  std::stable_sort( -      Result.begin(), Result.end(), -      [](const std::pair<unsigned, MDNode *> &A, -         const std::pair<unsigned, MDNode *> &B) { return A.first < B.first; }); +  llvm::stable_sort(Result, less_first());  }  void Instruction::setMetadata(StringRef Kind, MDNode *Node) { | 

