[PATCH] D125205: Replace the custom linked list in LeaderTableEntry with TinyPtrVector.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 13:49:17 PDT 2022


asbirlea accepted this revision.
asbirlea added a comment.
This revision is now accepted and ready to land.

Changes LGTM with inline nits.
@nikic I have not verified compile time impact with the latest diff.



================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:2108
                                          GVNPass &Gvn) {
-  LeaderTableEntry *Vals = &Gvn.LeaderTable[Num];
-  while (Vals && Vals->BB == BB)
-    Vals = Vals->Next;
-  return !Vals;
+  const LeaderTableEntry &entry = Gvn.LeaderTable[Num];
+  return all_of(entry.BB,
----------------
s/entry/Entry


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:2132
   CallInst *Call = nullptr;
-  LeaderTableEntry *Vals = &Gvn.LeaderTable[Num];
-  while (Vals) {
-    Call = dyn_cast<CallInst>(Vals->Val);
+  const LeaderTableEntry &entry = Gvn.LeaderTable[Num];
+  for (Value *Val : entry.Val) {
----------------
s/entry/Entry


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:2229
 Value *GVNPass::findLeader(const BasicBlock *BB, uint32_t num) {
-  LeaderTableEntry Vals = LeaderTable[num];
-  if (!Vals.Val) return nullptr;
+  const LeaderTableEntry &entry = LeaderTable[num];
+  if (entry.Val.empty())
----------------
s/entry/Entry


================
Comment at: llvm/lib/Transforms/Scalar/GVN.cpp:3041
   for (const auto &I : LeaderTable) {
-    const LeaderTableEntry *Node = &I.second;
-    assert(Node->Val != Inst && "Inst still in value numbering scope!");
-
-    while (Node->Next) {
-      Node = Node->Next;
-      assert(Node->Val != Inst && "Inst still in value numbering scope!");
+    const LeaderTableEntry &entry = I.second;
+    for (Value *Val : entry.Val) {
----------------
s/entry/Entry


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D125205/new/

https://reviews.llvm.org/D125205



More information about the llvm-commits mailing list