@@ -207,20 +207,20 @@ SILValue EscapeAnalysis::getPointerRoot(SILValue value) {
207
207
return value;
208
208
}
209
209
210
- static bool isNonWritableMemoryAddress (SILNode * V) {
210
+ static bool isNonWritableMemoryAddress (SILValue V) {
211
211
switch (V->getKind ()) {
212
- case SILNodeKind ::FunctionRefInst:
213
- case SILNodeKind ::DynamicFunctionRefInst:
214
- case SILNodeKind ::PreviousDynamicFunctionRefInst:
215
- case SILNodeKind ::WitnessMethodInst:
216
- case SILNodeKind ::ClassMethodInst:
217
- case SILNodeKind ::SuperMethodInst:
218
- case SILNodeKind ::ObjCMethodInst:
219
- case SILNodeKind ::ObjCSuperMethodInst:
220
- case SILNodeKind ::StringLiteralInst:
221
- case SILNodeKind ::ThinToThickFunctionInst:
222
- case SILNodeKind ::ThinFunctionToPointerInst:
223
- case SILNodeKind ::PointerToThinFunctionInst:
212
+ case ValueKind ::FunctionRefInst:
213
+ case ValueKind ::DynamicFunctionRefInst:
214
+ case ValueKind ::PreviousDynamicFunctionRefInst:
215
+ case ValueKind ::WitnessMethodInst:
216
+ case ValueKind ::ClassMethodInst:
217
+ case ValueKind ::SuperMethodInst:
218
+ case ValueKind ::ObjCMethodInst:
219
+ case ValueKind ::ObjCSuperMethodInst:
220
+ case ValueKind ::StringLiteralInst:
221
+ case ValueKind ::ThinToThickFunctionInst:
222
+ case ValueKind ::ThinFunctionToPointerInst:
223
+ case ValueKind ::PointerToThinFunctionInst:
224
224
// These instructions return pointers to memory which can't be a
225
225
// destination of a store.
226
226
return true ;
@@ -1622,8 +1622,10 @@ void EscapeAnalysis::ConnectionGraph::verify() const {
1622
1622
ReachableBlocks reachable (F);
1623
1623
reachable.visit ([this ](SILBasicBlock *bb) {
1624
1624
for (auto &i : *bb) {
1625
- if (isNonWritableMemoryAddress (&i))
1626
- continue ;
1625
+ if (auto *svi = dyn_cast<SingleValueInstruction>(&i)) {
1626
+ if (isNonWritableMemoryAddress (svi))
1627
+ continue ;
1628
+ }
1627
1629
1628
1630
if (auto ai = dyn_cast<ApplyInst>(&i)) {
1629
1631
if (EA->canOptimizeArrayUninitializedCall (ai).isValid ())
@@ -2060,17 +2062,17 @@ void EscapeAnalysis::analyzeInstruction(SILInstruction *I,
2060
2062
if (auto *SVI = dyn_cast<SingleValueInstruction>(I)) {
2061
2063
if (getPointerBase (SVI))
2062
2064
return ;
2065
+
2066
+ // Instructions which return the address of non-writable memory cannot have
2067
+ // an effect on escaping.
2068
+ if (isNonWritableMemoryAddress (SVI))
2069
+ return ;
2063
2070
}
2064
2071
2065
2072
// Incidental uses produce no values and have no effect on their operands.
2066
2073
if (isIncidentalUse (I))
2067
2074
return ;
2068
2075
2069
- // Instructions which return the address of non-writable memory cannot have
2070
- // an effect on escaping.
2071
- if (isNonWritableMemoryAddress (I))
2072
- return ;
2073
-
2074
2076
switch (I->getKind ()) {
2075
2077
case SILInstructionKind::AllocStackInst:
2076
2078
case SILInstructionKind::AllocRefInst:
0 commit comments