[BOLT][NFC] Use llvm::make_second_range

Reviewed By: #bolt, rafauler

Differential Revision: https://reviews.llvm.org/D143019
This commit is contained in:
Amir Ayupov
2023-02-02 12:02:02 -08:00
parent ad3a974b69
commit 72e5b14fe7
5 changed files with 19 additions and 26 deletions

View File

@@ -13,6 +13,7 @@
//===----------------------------------------------------------------------===//
#include "bolt/Profile/ProfileYAMLMapping.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/FileSystem.h"
@@ -398,9 +399,8 @@ int main(int argc, char **argv) {
BinaryProfile MergedProfile;
MergedProfile.Header = MergedHeader;
MergedProfile.Functions.resize(MergedBFs.size());
llvm::transform(
MergedBFs, MergedProfile.Functions.begin(),
[](StringMapEntry<BinaryFunctionProfile> &V) { return V.second; });
llvm::copy(llvm::make_second_range(MergedBFs),
MergedProfile.Functions.begin());
// For consistency, sort functions by their IDs.
llvm::sort(MergedProfile.Functions,