mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[AllocBoxToStack] Drop dead_end dealloc_boxes.
When creating `dealloc_stack`s corresponding to `dealloc_box`es, don't bother to create a dealloc_stack if the `dealloc_box` is flagged `dead_end`.
This commit is contained in:
@@ -709,6 +709,11 @@ static bool rewriteAllocBoxAsAllocStack(AllocBoxInst *ABI) {
|
||||
// instruction we found that isn't an explicit dealloc_box.
|
||||
Builder.emitDestroyAddrAndFold(Loc, valueToDestroy);
|
||||
}
|
||||
auto *dbi = dyn_cast<DeallocBoxInst>(LastRelease);
|
||||
if (dbi && dbi->isDeadEnd()) {
|
||||
// Don't bother to create dealloc_stack instructions in dead-ends.
|
||||
continue;
|
||||
}
|
||||
Builder.createDeallocStack(Loc, ASI);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user