[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:36:28 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;
----------------
resistor wrote:

Agreed that it's probably unneeded, but it preserves the original semantics of `if (!Vals.Val) return nullptr;`. I'd prefer to avoid avoid changing the semantics so as not to introduce unintended functional changes in this patch.

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


More information about the llvm-commits mailing list