[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


================
@@ -2203,10 +2265,10 @@ 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);
+  return std::all_of(
+      I.begin(), I.end(),
----------------
nikic wrote:

```suggestion
  return all_of(
      I,
```

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


More information about the llvm-commits mailing list