Skip to content

Commit 06750f7

Browse files
committed
SIL Optimizer: Fix bug in EscapeAnalysis::isReachable()
We weren't clearing the worklist flags if returning true here. Oops! This would manifest as alias analysis returning different results for the same operands over time, which confused ARC code motion into dropping release instructions.
1 parent 821cdf3 commit 06750f7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/SILOptimizer/Analysis/EscapeAnalysis.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,10 @@ bool EscapeAnalysis::ConnectionGraph::isReachable(CGNode *From, CGNode *To) {
561561
From->isInWorkList = true;
562562
for (unsigned Idx = 0; Idx < WorkList.size(); ++Idx) {
563563
CGNode *Reachable = WorkList[Idx];
564-
if (Reachable == To)
564+
if (Reachable == To) {
565+
clearWorkListFlags(WorkList);
565566
return true;
567+
}
566568
for (Predecessor Pred : Reachable->Preds) {
567569
CGNode *PredNode = Pred.getPointer();
568570
if (!PredNode->isInWorkList) {

0 commit comments

Comments
 (0)