File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
lib/SILOptimizer/Transforms Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -3420,6 +3420,16 @@ bool SimplifyCFG::simplifyProgramTerminationBlock(SILBasicBlock *BB) {
3420
3420
bool Changed = false ;
3421
3421
llvm::SmallPtrSet<SILInstruction *, 4 > InstsToRemove;
3422
3422
for (auto &I : *BB) {
3423
+ // We can only remove the instructions below from the ARC-inert BB
3424
+ // We *can't* replace copy_addr with move instructions:
3425
+ // If the copy_addr was [take] [initialization]:
3426
+ // * previous passes would have replaced it with moves
3427
+ // If the copy_addr contains [initialization]:
3428
+ // * nothing we can do - the target address is invalid
3429
+ // Else, i.e. the copy_addr was [take] assignment, it is not always safe:
3430
+ // The type being operated on might contain weak references,
3431
+ // or other side references - We'll corrupt the weak reference table
3432
+ // if we fail to release the old value.
3423
3433
if (!isa<StrongReleaseInst>(I) && !isa<UnownedReleaseInst>(I) &&
3424
3434
!isa<ReleaseValueInst>(I) && !isa<DestroyAddrInst>(I))
3425
3435
continue ;
You can’t perform that action at this time.
0 commit comments