EscapeAnalysis: Invert defer edges for array semantics.

Defer edges should always point to the more specific SSA value. For
example, the contents of a memory location point to the values stored
in that locations. Tuples point to their elements. BBArgs point to
their source operands. Likewise, array objects should point to their
exposed unsafe pointer (which is effectively a value stored in the
array object). I'm not sure why the defer edges were reversed in the
first place, but it was always confusing me.
This commit is contained in:
Andrew Trick
2020-01-19 22:38:31 -08:00
parent 78a8cac400
commit bd2bb2e8de
2 changed files with 6 additions and 6 deletions

View File

@@ -1891,7 +1891,7 @@ void EscapeAnalysis::analyzeInstruction(SILInstruction *I,
if (LoadedElement) {
if (CGNode *arrayElementStorage =
ConGraph->getFieldContent(ArrayObjNode)) {
ConGraph->defer(LoadedElement, arrayElementStorage);
ConGraph->defer(arrayElementStorage, LoadedElement);
return;
}
}
@@ -1902,7 +1902,7 @@ void EscapeAnalysis::analyzeInstruction(SILInstruction *I,
// returned address point to the same element storage.
if (CGNode *ArrayObjNode = ConGraph->getValueContent(ASC.getSelf())) {
CGNode *arrayElementAddress = ConGraph->getNode(ASC.getCallResult());
ConGraph->defer(arrayElementAddress, ArrayObjNode);
ConGraph->defer(ArrayObjNode, arrayElementAddress);
return;
}
break;