From e3b557809604d036af6e00c60f012c2025b59a5e Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 11 Feb 2023 13:38:04 +0100 Subject: Vendor import of llvm-project main llvmorg-16-init-18548-gb0daacf58f41, the last commit before the upstream release/17.x branch was created. --- llvm/lib/Analysis/CaptureTracking.cpp | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'llvm/lib/Analysis/CaptureTracking.cpp') diff --git a/llvm/lib/Analysis/CaptureTracking.cpp b/llvm/lib/Analysis/CaptureTracking.cpp index f4fd660ac7e0..7f3a2b49aca9 100644 --- a/llvm/lib/Analysis/CaptureTracking.cpp +++ b/llvm/lib/Analysis/CaptureTracking.cpp @@ -179,25 +179,10 @@ namespace { if (EphValues.contains(I)) return false; - if (!EarliestCapture) { + if (!EarliestCapture) EarliestCapture = I; - } else if (EarliestCapture->getParent() == I->getParent()) { - if (I->comesBefore(EarliestCapture)) - EarliestCapture = I; - } else { - BasicBlock *CurrentBB = I->getParent(); - BasicBlock *EarliestBB = EarliestCapture->getParent(); - if (DT.dominates(EarliestBB, CurrentBB)) { - // EarliestCapture already comes before the current use. - } else if (DT.dominates(CurrentBB, EarliestBB)) { - EarliestCapture = I; - } else { - // Otherwise find the nearest common dominator and use its terminator. - auto *NearestCommonDom = - DT.findNearestCommonDominator(CurrentBB, EarliestBB); - EarliestCapture = NearestCommonDom->getTerminator(); - } - } + else + EarliestCapture = DT.findNearestCommonDominator(EarliestCapture, I); Captured = true; // Return false to continue analysis; we need to see all potential -- cgit v1.2.3