diff options
| author | Kazu Hirata <kazu@google.com> | 2025-10-21 07:22:23 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-21 07:22:23 -0700 |
| commit | 4098e263ff77122f321562c7e66b2da96f03f604 (patch) | |
| tree | 1cd8e3ae5b116cfdd9f632eee4d685639a6eb43d /llvm/lib/CodeGen | |
| parent | 58abcf6bc68942f25f89f68f2770f9e55f24eab0 (diff) | |
| download | llvm-4098e263ff77122f321562c7e66b2da96f03f604.zip llvm-4098e263ff77122f321562c7e66b2da96f03f604.tar.gz llvm-4098e263ff77122f321562c7e66b2da96f03f604.tar.bz2 | |
[ADT] Modernize SparseSet to use llvm::identity_cxx20 (NFC) (#164362)
The legacy llvm::identity is not quite the same as std::identity from
C++20. llvm::identity is a template struct with an ::argument_type
member. In contrast, llvm::identity_cxx20 (and std::identity) is a
non-template struct with a templated call operator and no
::argument_type.
This patch modernizes llvm::SparseSet by updating its default
key-extraction functor to llvm::identity_cxx20. A new template
parameter KeyT takes over the role of ::argument_type.
Existing uses of SparseSet are updated for the new template signature.
Most use sites are of the form SparseSet<T>, requiring no update.
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/IfConversion.cpp | 2 | ||||
| -rw-r--r-- | llvm/lib/CodeGen/RegAllocFast.cpp | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/IfConversion.cpp b/llvm/lib/CodeGen/IfConversion.cpp index f80e1e8..3ac6d2a 100644 --- a/llvm/lib/CodeGen/IfConversion.cpp +++ b/llvm/lib/CodeGen/IfConversion.cpp @@ -1498,7 +1498,7 @@ static void UpdatePredRedefs(MachineInstr &MI, LivePhysRegs &Redefs) { // Before stepping forward past MI, remember which regs were live // before MI. This is needed to set the Undef flag only when reg is // dead. - SparseSet<MCPhysReg, identity<MCPhysReg>> LiveBeforeMI; + SparseSet<MCPhysReg, MCPhysReg> LiveBeforeMI; LiveBeforeMI.setUniverse(TRI->getNumRegs()); for (unsigned Reg : Redefs) LiveBeforeMI.insert(Reg); diff --git a/llvm/lib/CodeGen/RegAllocFast.cpp b/llvm/lib/CodeGen/RegAllocFast.cpp index 804480c..72b364c 100644 --- a/llvm/lib/CodeGen/RegAllocFast.cpp +++ b/llvm/lib/CodeGen/RegAllocFast.cpp @@ -211,7 +211,7 @@ private: unsigned getSparseSetIndex() const { return VirtReg.virtRegIndex(); } }; - using LiveRegMap = SparseSet<LiveReg, identity<unsigned>, uint16_t>; + using LiveRegMap = SparseSet<LiveReg, unsigned, identity_cxx20, uint16_t>; /// This map contains entries for each virtual register that is currently /// available in a physical register. LiveRegMap LiveVirtRegs; |
