[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:58 PDT 2024


================
@@ -2228,12 +2290,11 @@ bool GVNPass::ValueTable::areCallValsEqual(uint32_t Num, uint32_t NewNum,
                                            const BasicBlock *PhiBlock,
                                            GVNPass &Gvn) {
   CallInst *Call = nullptr;
-  LeaderTableEntry *Vals = &Gvn.LeaderTable[Num];
-  while (Vals) {
-    Call = dyn_cast<CallInst>(Vals->Val);
+  auto Leaders = Gvn.LeaderTable.getLeaders(Num);
+  for (auto Entry : Leaders) {
----------------
nikic wrote:

```suggestion
  for (const auto &Entry : Leaders) {
```
Probably?

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


More information about the llvm-commits mailing list