Skip to content

Commit f7b5d2d

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 ed060de commit f7b5d2d

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
@@ -560,8 +560,10 @@ bool EscapeAnalysis::ConnectionGraph::isReachable(CGNode *From, CGNode *To) {
560560
From->isInWorkList = true;
561561
for (unsigned Idx = 0; Idx < WorkList.size(); ++Idx) {
562562
CGNode *Reachable = WorkList[Idx];
563-
if (Reachable == To)
563+
if (Reachable == To) {
564+
clearWorkListFlags(WorkList);
564565
return true;
566+
}
565567
for (Predecessor Pred : Reachable->Preds) {
566568
CGNode *PredNode = Pred.getPointer();
567569
if (!PredNode->isInWorkList) {

0 commit comments

Comments
 (0)