mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Mark begin_access is non-clonable (!isTriviallyDuplicatable()).
In one shot, this prevents multiple CFG transforms from breaking the simple begin/end access marker pattern for access scopes.
This commit is contained in:
@@ -1142,9 +1142,6 @@ SILInstruction *SILInstruction::clone(SILInstruction *InsertPt) {
|
||||
/// additional handling. It is important to know this information when
|
||||
/// you perform such optimizations like e.g. jump-threading.
|
||||
bool SILInstruction::isTriviallyDuplicatable() const {
|
||||
if (isa<ThrowInst>(this))
|
||||
return false;
|
||||
|
||||
if (isa<AllocStackInst>(this) || isa<DeallocStackInst>(this)) {
|
||||
return false;
|
||||
}
|
||||
@@ -1152,7 +1149,6 @@ bool SILInstruction::isTriviallyDuplicatable() const {
|
||||
if (ARI->canAllocOnStack())
|
||||
return false;
|
||||
}
|
||||
|
||||
if (isa<OpenExistentialAddrInst>(this) || isa<OpenExistentialRefInst>(this) ||
|
||||
isa<OpenExistentialMetatypeInst>(this) ||
|
||||
isa<OpenExistentialValueInst>(this) || isa<OpenExistentialBoxInst>(this) ||
|
||||
@@ -1169,6 +1165,13 @@ bool SILInstruction::isTriviallyDuplicatable() const {
|
||||
if (MI->getMember().isForeign)
|
||||
return false;
|
||||
}
|
||||
if (isa<ThrowInst>(this))
|
||||
return false;
|
||||
|
||||
// BeginAccess defines the access scope entry point. All associated EndAccess
|
||||
// instructions must directly operate on the BeginAccess.
|
||||
if (isa<BeginAccessInst>(this))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user