mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user