================
@@ -438,18 +445,28 @@ void llvm::PointerMayBeCaptured(const Value *V, 
CaptureTracker *Tracker,
   };
   while (!Worklist.empty()) {
     const Use *U = Worklist.pop_back_val();
-    switch (DetermineUseCaptureKind(*U, IsDereferenceableOrNull)) {
-    case UseCaptureKind::NO_CAPTURE:
+    CaptureInfo CI = DetermineUseCaptureKind(*U, IsDereferenceableOrNull);
+    if (capturesNothing(CI))
       continue;
-    case UseCaptureKind::MAY_CAPTURE:
-      if (Tracker->captured(U))
+    CaptureComponents OtherCC = CI.getOtherComponents();
+    CaptureComponents RetCC = CI.getRetComponents();
+    if (capturesAnything(OtherCC)) {
+      switch (Tracker->captured(U, CI)) {
+      case CaptureTracker::Stop:
         return;
-      continue;
-    case UseCaptureKind::PASSTHROUGH:
-      if (!AddUses(U->getUser()))
-        return;
-      continue;
+      case CaptureTracker::ContinueIgnoringReturn:
+        continue;
+      case CaptureTracker::Continue:
+        // Fall through to passthrough handling, but only if RetCC contains
+        // additional components that OtherCC does not.
----------------
goldsteinn wrote:

The argument being that if captures via some component by `other`, there is not 
use in refining `ret` as we will be hamstrung by the other condition during 
analysis?

https://github.com/llvm/llvm-project/pull/125880
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to