[PATCH] D126236: [CaptureTracking] Increase limit but use it for all visited uses.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 2 13:44:57 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
fhahn marked an inline comment as done.
Closed by commit rG78c6b1488f30: [CaptureTracking] Increase limit and use it for all visited uses. (authored by fhahn).

Changed prior to commit:
  https://reviews.llvm.org/D126236?vs=431461&id=433871#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D126236

Files:
  llvm/lib/Analysis/CaptureTracking.cpp
  llvm/test/Transforms/GVN/capture-tracking-limit.ll


Index: llvm/test/Transforms/GVN/capture-tracking-limit.ll
===================================================================
--- llvm/test/Transforms/GVN/capture-tracking-limit.ll
+++ llvm/test/Transforms/GVN/capture-tracking-limit.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
-; RUN: opt -aa-pipeline=basic-aa -passes="gvn" -S %s | FileCheck --check-prefixes=CHECK,LIMIT-TOO-SMALL  %s
+; RUN: opt -aa-pipeline=basic-aa -passes="gvn" -S %s | FileCheck --check-prefixes=CHECK,LIMIT %s
 ; RUN: opt -aa-pipeline=basic-aa -passes="gvn" -S -capture-tracking-max-uses-to-explore=20 %s | FileCheck --check-prefixes=CHECK,LIMIT-TOO-SMALL %s
 ; RUN: opt -aa-pipeline=basic-aa -passes="gvn" -S -capture-tracking-max-uses-to-explore=21 %s | FileCheck --check-prefixes=CHECK,LIMIT %s
 
Index: llvm/lib/Analysis/CaptureTracking.cpp
===================================================================
--- llvm/lib/Analysis/CaptureTracking.cpp
+++ llvm/lib/Analysis/CaptureTracking.cpp
@@ -45,9 +45,9 @@
 /// use it where possible. The caching version can use much higher limit or
 /// don't have this cap at all.
 static cl::opt<unsigned>
-DefaultMaxUsesToExplore("capture-tracking-max-uses-to-explore", cl::Hidden,
-                        cl::desc("Maximal number of uses to explore."),
-                        cl::init(20));
+    DefaultMaxUsesToExplore("capture-tracking-max-uses-to-explore", cl::Hidden,
+                            cl::desc("Maximal number of uses to explore."),
+                            cl::init(100));
 
 unsigned llvm::getDefaultMaxUsesToExploreForCaptureTracking() {
   return DefaultMaxUsesToExplore;
@@ -445,11 +445,10 @@
   SmallSet<const Use *, 20> Visited;
 
   auto AddUses = [&](const Value *V) {
-    unsigned Count = 0;
     for (const Use &U : V->uses()) {
       // If there are lots of uses, conservatively say that the value
       // is captured to avoid taking too much compile time.
-      if (Count++ >= MaxUsesToExplore) {
+      if (Visited.size()  >= MaxUsesToExplore) {
         Tracker->tooManyUses();
         return false;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126236.433871.patch
Type: text/x-patch
Size: 2124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220602/6172634f/attachment.bin>


More information about the llvm-commits mailing list