[PATCH] D153561: [SCCPSolver] Speed up SCCPSolver by avoiding repeated work list elements

Benjamin Kramer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 23 01:24:09 PDT 2023


This revision was automatically updated to reflect the committed changes.
Closed by commit rG248b85344b08: [SCCPSolver] Speed up SCCPSolver by avoiding repeated work list elements (authored by tdanyluk, committed by bkramer).

Changed prior to commit:
  https://reviews.llvm.org/D153561?vs=533618&id=533895#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153561

Files:
  llvm/lib/Transforms/Utils/SCCPSolver.cpp


Index: llvm/lib/Transforms/Utils/SCCPSolver.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SCCPSolver.cpp
+++ llvm/lib/Transforms/Utils/SCCPSolver.cpp
@@ -838,9 +838,13 @@
 }
 
 void SCCPInstVisitor::pushToWorkList(ValueLatticeElement &IV, Value *V) {
-  if (IV.isOverdefined())
-    return OverdefinedInstWorkList.push_back(V);
-  InstWorkList.push_back(V);
+  if (IV.isOverdefined()) {
+    if (OverdefinedInstWorkList.empty() || OverdefinedInstWorkList.back() != V)
+      OverdefinedInstWorkList.push_back(V);
+    return;
+  }
+  if (InstWorkList.empty() || InstWorkList.back() != V)
+    InstWorkList.push_back(V);
 }
 
 void SCCPInstVisitor::pushToWorkListMsg(ValueLatticeElement &IV, Value *V) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153561.533895.patch
Type: text/x-patch
Size: 759 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230623/e593ee4b/attachment.bin>


More information about the llvm-commits mailing list