aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Analysis/CaptureTracking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Analysis/CaptureTracking.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Analysis/CaptureTracking.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/contrib/llvm-project/llvm/lib/Analysis/CaptureTracking.cpp b/contrib/llvm-project/llvm/lib/Analysis/CaptureTracking.cpp
index f4fd660ac7e0..7f3a2b49aca9 100644
--- a/contrib/llvm-project/llvm/lib/Analysis/CaptureTracking.cpp
+++ b/contrib/llvm-project/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