File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -81,6 +81,9 @@ bool SILLoop::canDuplicate(SILInstruction *I) const {
81
81
if (isa<ThrowInst>(I))
82
82
return false ;
83
83
84
+ if (isa<BeginAccessInst>(I))
85
+ return false ;
86
+
84
87
assert (I->isTriviallyDuplicatable () &&
85
88
" Code here must match isTriviallyDuplicatable in SILInstruction" );
86
89
return true ;
Original file line number Diff line number Diff line change @@ -1142,17 +1142,13 @@ SILInstruction *SILInstruction::clone(SILInstruction *InsertPt) {
1142
1142
// / additional handling. It is important to know this information when
1143
1143
// / you perform such optimizations like e.g. jump-threading.
1144
1144
bool SILInstruction::isTriviallyDuplicatable () const {
1145
- if (isa<ThrowInst>(this ))
1146
- return false ;
1147
-
1148
1145
if (isa<AllocStackInst>(this ) || isa<DeallocStackInst>(this )) {
1149
1146
return false ;
1150
1147
}
1151
1148
if (auto *ARI = dyn_cast<AllocRefInst>(this )) {
1152
1149
if (ARI->canAllocOnStack ())
1153
1150
return false ;
1154
1151
}
1155
-
1156
1152
if (isa<OpenExistentialAddrInst>(this ) || isa<OpenExistentialRefInst>(this ) ||
1157
1153
isa<OpenExistentialMetatypeInst>(this ) ||
1158
1154
isa<OpenExistentialValueInst>(this ) || isa<OpenExistentialBoxInst>(this ) ||
@@ -1169,6 +1165,13 @@ bool SILInstruction::isTriviallyDuplicatable() const {
1169
1165
if (MI->getMember ().isForeign )
1170
1166
return false ;
1171
1167
}
1168
+ if (isa<ThrowInst>(this ))
1169
+ return false ;
1170
+
1171
+ // BeginAccess defines the access scope entry point. All associated EndAccess
1172
+ // instructions must directly operate on the BeginAccess.
1173
+ if (isa<BeginAccessInst>(this ))
1174
+ return false ;
1172
1175
1173
1176
return true ;
1174
1177
}
You can’t perform that action at this time.
0 commit comments