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.
This commit is contained in:
Slava Pestov
2016-09-21 20:05:23 -07:00
parent 821cdf368d
commit 06750f7f43

View File

@@ -561,8 +561,10 @@ bool EscapeAnalysis::ConnectionGraph::isReachable(CGNode *From, CGNode *To) {
From->isInWorkList = true;
for (unsigned Idx = 0; Idx < WorkList.size(); ++Idx) {
CGNode *Reachable = WorkList[Idx];
if (Reachable == To)
if (Reachable == To) {
clearWorkListFlags(WorkList);
return true;
}
for (Predecessor Pred : Reachable->Preds) {
CGNode *PredNode = Pred.getPointer();
if (!PredNode->isInWorkList) {