[llvm] Refactor the LeaderTable structure in GVN into a properly encapsulated data structure. (PR #88347)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 20:01:57 PDT 2024


================
@@ -2326,23 +2387,17 @@ void GVNPass::ValueTable::eraseTranslateCacheEntry(
 // question.  This is fast because dominator tree queries consist of only
 // a few comparisons of DFS numbers.
 Value *GVNPass::findLeader(const BasicBlock *BB, uint32_t num) {
-  LeaderTableEntry Vals = LeaderTable[num];
-  if (!Vals.Val) return nullptr;
+  auto Leaders = LeaderTable.getLeaders(num);
+  if (Leaders.empty())
+    return nullptr;
----------------
nikic wrote:

Seems like we don't need this explicit check?

https://github.com/llvm/llvm-project/pull/88347


More information about the llvm-commits mailing list