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

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 25 21:41:00 PDT 2024


================
@@ -2204,10 +2267,9 @@ GVNPass::ValueTable::assignExpNewValueNum(Expression &Exp) {
 /// defined in \p BB.
 bool GVNPass::ValueTable::areAllValsInBB(uint32_t Num, const BasicBlock *BB,
                                          GVNPass &Gvn) {
-  LeaderTableEntry *Vals = &Gvn.LeaderTable[Num];
-  while (Vals && Vals->BB == BB)
-    Vals = Vals->Next;
-  return !Vals;
+  auto I = Gvn.LeaderTable.getLeaders(Num);
----------------
nikic wrote:

I'd probably skip putting this into variable now that you don't need the separate being/end calls...

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


More information about the llvm-commits mailing list