[llvm] [BOLT] Use llvm::unique (NFC) (PR #136513)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Sun Apr 20 14:56:12 PDT 2025
https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/136513
None
>From 2487c8dc3bde183a51d99d235f872a92e9e7e58d Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 19 Apr 2025 20:35:50 -0700
Subject: [PATCH] [BOLT] Use llvm::unique (NFC)
---
bolt/lib/Core/BinaryBasicBlock.cpp | 3 +--
bolt/lib/Core/BinaryFunction.cpp | 2 +-
bolt/lib/Core/DebugNames.cpp | 3 +--
3 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/bolt/lib/Core/BinaryBasicBlock.cpp b/bolt/lib/Core/BinaryBasicBlock.cpp
index 2a2192b79bb4b..311d5c15b8dca 100644
--- a/bolt/lib/Core/BinaryBasicBlock.cpp
+++ b/bolt/lib/Core/BinaryBasicBlock.cpp
@@ -372,8 +372,7 @@ void BinaryBasicBlock::updateJumpTableSuccessors() {
[](const BinaryBasicBlock *BB1, const BinaryBasicBlock *BB2) {
return BB1->getInputOffset() < BB2->getInputOffset();
});
- SuccessorBBs.erase(std::unique(SuccessorBBs.begin(), SuccessorBBs.end()),
- SuccessorBBs.end());
+ SuccessorBBs.erase(llvm::unique(SuccessorBBs), SuccessorBBs.end());
for (BinaryBasicBlock *BB : SuccessorBBs)
addSuccessor(BB);
diff --git a/bolt/lib/Core/BinaryFunction.cpp b/bolt/lib/Core/BinaryFunction.cpp
index 184a4462b356a..4624abadc701a 100644
--- a/bolt/lib/Core/BinaryFunction.cpp
+++ b/bolt/lib/Core/BinaryFunction.cpp
@@ -2376,7 +2376,7 @@ Error BinaryFunction::buildCFG(MCPlusBuilder::AllocatorIdTy AllocatorId) {
// Without doing jump table value profiling we don't have a use for extra
// (duplicate) branches.
llvm::sort(TakenBranches);
- auto NewEnd = std::unique(TakenBranches.begin(), TakenBranches.end());
+ auto NewEnd = llvm::unique(TakenBranches);
TakenBranches.erase(NewEnd, TakenBranches.end());
for (std::pair<uint32_t, uint32_t> &Branch : TakenBranches) {
diff --git a/bolt/lib/Core/DebugNames.cpp b/bolt/lib/Core/DebugNames.cpp
index 366c22c38e616..82cabe689eb14 100644
--- a/bolt/lib/Core/DebugNames.cpp
+++ b/bolt/lib/Core/DebugNames.cpp
@@ -440,8 +440,7 @@ void DWARF5AcceleratorTable::computeBucketCount() {
for (const auto &E : Entries)
Uniques.push_back(E.second.HashValue);
array_pod_sort(Uniques.begin(), Uniques.end());
- std::vector<uint32_t>::iterator P =
- std::unique(Uniques.begin(), Uniques.end());
+ std::vector<uint32_t>::iterator P = llvm::unique(Uniques);
UniqueHashCount = std::distance(Uniques.begin(), P);
More information about the llvm-commits
mailing list