[llvm] 8388a5b - [ADT] Rename identity_cxx20 to identity (#164927)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 24 15:30:46 PDT 2025
Author: Kazu Hirata
Date: 2025-10-24T15:30:42-07:00
New Revision: 8388a5b3403a4f711890a397ec577a11bb9d5fc3
URL: https://github.com/llvm/llvm-project/commit/8388a5b3403a4f711890a397ec577a11bb9d5fc3
DIFF: https://github.com/llvm/llvm-project/commit/8388a5b3403a4f711890a397ec577a11bb9d5fc3.diff
LOG: [ADT] Rename identity_cxx20 to identity (#164927)
Now that the old llvm::identity has moved into IndexedMap.h under a
different name, this patch renames identity_cxx20 to identity. Note
that llvm::identity closely models std::identity from C++20.
Added:
Modified:
llvm/include/llvm/ADT/STLForwardCompat.h
llvm/include/llvm/ADT/SparseMultiSet.h
llvm/include/llvm/ADT/SparseSet.h
llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
llvm/lib/CodeGen/RegAllocFast.cpp
llvm/unittests/ADT/STLForwardCompatTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/ADT/STLForwardCompat.h b/llvm/include/llvm/ADT/STLForwardCompat.h
index 9c81981534506..e02694f043fbb 100644
--- a/llvm/include/llvm/ADT/STLForwardCompat.h
+++ b/llvm/include/llvm/ADT/STLForwardCompat.h
@@ -125,7 +125,7 @@ struct detector<std::void_t<Op<Args...>>, Op, Args...> {
template <template <class...> class Op, class... Args>
using is_detected = typename detail::detector<void, Op, Args...>::value_t;
-struct identity_cxx20 // NOLINT(readability-identifier-naming)
+struct identity // NOLINT(readability-identifier-naming)
{
using is_transparent = void;
diff --git a/llvm/include/llvm/ADT/SparseMultiSet.h b/llvm/include/llvm/ADT/SparseMultiSet.h
index 5e4e1703373a9..59de4cf6a553b 100644
--- a/llvm/include/llvm/ADT/SparseMultiSet.h
+++ b/llvm/include/llvm/ADT/SparseMultiSet.h
@@ -82,7 +82,7 @@ namespace llvm {
/// @tparam SparseT An unsigned integer type. See above.
///
template <typename ValueT, typename KeyT = unsigned,
- typename KeyFunctorT = identity_cxx20, typename SparseT = uint8_t>
+ typename KeyFunctorT = identity, typename SparseT = uint8_t>
class SparseMultiSet {
static_assert(std::is_unsigned_v<SparseT>,
"SparseT must be an unsigned integer type");
diff --git a/llvm/include/llvm/ADT/SparseSet.h b/llvm/include/llvm/ADT/SparseSet.h
index 2ac23cc4cfa13..41fd501911f2c 100644
--- a/llvm/include/llvm/ADT/SparseSet.h
+++ b/llvm/include/llvm/ADT/SparseSet.h
@@ -113,7 +113,7 @@ struct SparseSetValFunctor {
/// @tparam SparseT An unsigned integer type. See above.
///
template <typename ValueT, typename KeyT = unsigned,
- typename KeyFunctorT = identity_cxx20, typename SparseT = uint8_t>
+ typename KeyFunctorT = identity, typename SparseT = uint8_t>
class SparseSet {
static_assert(std::is_unsigned_v<SparseT>,
"SparseT must be an unsigned integer type");
diff --git a/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h b/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
index 26d708060ed6d..ab0d7e334df44 100644
--- a/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
+++ b/llvm/include/llvm/CodeGen/ScheduleDAGInstrs.h
@@ -89,7 +89,7 @@ namespace llvm {
/// allocated once for the pass. It can be cleared in constant time and reused
/// without any frees.
using RegUnit2SUnitsMap =
- SparseMultiSet<PhysRegSUOper, unsigned, identity_cxx20, uint16_t>;
+ SparseMultiSet<PhysRegSUOper, unsigned, identity, uint16_t>;
/// Track local uses of virtual registers. These uses are gathered by the DAG
/// builder and may be consulted by the scheduler to avoid iterating an entire
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
index 4a32113b460e1..6adaa8ae43895 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/ExecutorAddress.h
@@ -34,7 +34,7 @@ using ExecutorAddrDiff = uint64_t;
class ExecutorAddr {
public:
/// A wrap/unwrap function that leaves pointers unmodified.
- using rawPtr = llvm::identity_cxx20;
+ using rawPtr = llvm::identity;
#if __has_feature(ptrauth_calls)
template <typename T> class PtrauthSignDefault {
diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp
index 72b364c5668e2..697b779e10106 100644
--- a/llvm/lib/CodeGen/RegAllocFast.cpp
+++ b/llvm/lib/CodeGen/RegAllocFast.cpp
@@ -211,7 +211,7 @@ class RegAllocFastImpl {
unsigned getSparseSetIndex() const { return VirtReg.virtRegIndex(); }
};
- using LiveRegMap = SparseSet<LiveReg, unsigned, identity_cxx20, uint16_t>;
+ using LiveRegMap = SparseSet<LiveReg, unsigned, identity, uint16_t>;
/// This map contains entries for each virtual register that is currently
/// available in a physical register.
LiveRegMap LiveVirtRegs;
diff --git a/llvm/unittests/ADT/STLForwardCompatTest.cpp b/llvm/unittests/ADT/STLForwardCompatTest.cpp
index 2a97e8d6a552f..c6ae6e36cfbff 100644
--- a/llvm/unittests/ADT/STLForwardCompatTest.cpp
+++ b/llvm/unittests/ADT/STLForwardCompatTest.cpp
@@ -185,7 +185,7 @@ TEST(TransformTest, ToUnderlying) {
}
TEST(STLForwardCompatTest, IdentityCxx20) {
- llvm::identity_cxx20 identity;
+ llvm::identity identity;
// Test with an lvalue.
int X = 42;
More information about the llvm-commits
mailing list