@@ -1508,54 +1508,49 @@ struct DSEState {
1508
1508
CommonPred = PDT.findNearestCommonDominator (CommonPred, BB);
1509
1509
}
1510
1510
1511
- // If CommonPred is in the set of killing blocks, just check if it
1512
- // post-dominates MaybeDeadAccess.
1513
- if (KillingBlocks.count (CommonPred)) {
1514
- if (PDT.dominates (CommonPred, MaybeDeadAccess->getBlock ()))
1515
- return {MaybeDeadAccess};
1516
- return None;
1517
- }
1518
-
1519
1511
// If the common post-dominator does not post-dominate MaybeDeadAccess,
1520
1512
// there is a path from MaybeDeadAccess to an exit not going through a
1521
1513
// killing block.
1522
- if (PDT.dominates (CommonPred, MaybeDeadAccess->getBlock ())) {
1523
- SetVector<BasicBlock *> WorkList;
1524
-
1525
- // If CommonPred is null, there are multiple exits from the function.
1526
- // They all have to be added to the worklist.
1527
- if (CommonPred)
1528
- WorkList.insert (CommonPred);
1529
- else
1530
- for (BasicBlock *R : PDT.roots ())
1531
- WorkList.insert (R);
1532
-
1533
- NumCFGTries++;
1534
- // Check if all paths starting from an exit node go through one of the
1535
- // killing blocks before reaching MaybeDeadAccess.
1536
- for (unsigned I = 0 ; I < WorkList.size (); I++) {
1537
- NumCFGChecks++;
1538
- BasicBlock *Current = WorkList[I];
1539
- if (KillingBlocks.count (Current))
1540
- continue ;
1541
- if (Current == MaybeDeadAccess->getBlock ())
1542
- return None;
1514
+ if (!PDT.dominates (CommonPred, MaybeDeadAccess->getBlock ()))
1515
+ return None;
1543
1516
1544
- // MaybeDeadAccess is reachable from the entry, so we don't have to
1545
- // explore unreachable blocks further.
1546
- if (!DT.isReachableFromEntry (Current))
1547
- continue ;
1517
+ // If CommonPred itself is in the set of killing blocks, we're done.
1518
+ if (KillingBlocks.count (CommonPred))
1519
+ return {MaybeDeadAccess};
1548
1520
1549
- for (BasicBlock *Pred : predecessors (Current))
1550
- WorkList.insert (Pred);
1521
+ SetVector<BasicBlock *> WorkList;
1551
1522
1552
- if (WorkList.size () >= MemorySSAPathCheckLimit)
1553
- return None;
1554
- }
1555
- NumCFGSuccess++;
1556
- return {MaybeDeadAccess};
1523
+ // If CommonPred is null, there are multiple exits from the function.
1524
+ // They all have to be added to the worklist.
1525
+ if (CommonPred)
1526
+ WorkList.insert (CommonPred);
1527
+ else
1528
+ for (BasicBlock *R : PDT.roots ())
1529
+ WorkList.insert (R);
1530
+
1531
+ NumCFGTries++;
1532
+ // Check if all paths starting from an exit node go through one of the
1533
+ // killing blocks before reaching MaybeDeadAccess.
1534
+ for (unsigned I = 0 ; I < WorkList.size (); I++) {
1535
+ NumCFGChecks++;
1536
+ BasicBlock *Current = WorkList[I];
1537
+ if (KillingBlocks.count (Current))
1538
+ continue ;
1539
+ if (Current == MaybeDeadAccess->getBlock ())
1540
+ return None;
1541
+
1542
+ // MaybeDeadAccess is reachable from the entry, so we don't have to
1543
+ // explore unreachable blocks further.
1544
+ if (!DT.isReachableFromEntry (Current))
1545
+ continue ;
1546
+
1547
+ for (BasicBlock *Pred : predecessors (Current))
1548
+ WorkList.insert (Pred);
1549
+
1550
+ if (WorkList.size () >= MemorySSAPathCheckLimit)
1551
+ return None;
1557
1552
}
1558
- return None ;
1553
+ NumCFGSuccess++ ;
1559
1554
}
1560
1555
1561
1556
// No aliasing MemoryUses of MaybeDeadAccess found, MaybeDeadAccess is
0 commit comments