[llvm] [GVN] Refactor the LeaderTable structure into a properly encapsulated data structure (PR #88347)
Owen Anderson via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 25 14:38:55 PDT 2024
================
@@ -232,13 +232,67 @@ class GVNPass : public PassInfoMixin<GVNPass> {
/// A mapping from value numbers to lists of Value*'s that
/// have that value number. Use findLeader to query it.
- struct LeaderTableEntry {
- Value *Val;
- const BasicBlock *BB;
- LeaderTableEntry *Next;
+ class LeaderMap {
+ public:
+ struct LeaderTableEntry {
+ Value *Val;
+ const BasicBlock *BB;
+ };
+
+ private:
+ struct LeaderListNode {
+ LeaderTableEntry Entry;
+ LeaderListNode *Next;
+ };
+ DenseMap<uint32_t, LeaderListNode> NumToLeaders;
+ BumpPtrAllocator TableAllocator;
+
+ public:
+ class leader_iterator {
+ const LeaderListNode *current;
----------------
resistor wrote:
Done
https://github.com/llvm/llvm-project/pull/88347
More information about the llvm-commits
mailing list