Skip to content

Commit b760ab0

Browse files
committed
DeadStoreElimination: don't assume that the operand of an dealloc_stack is an alloc_stack.
It can also be a `partial_apply`. Fixes a compiler crash swiftlang#81698 rdar://151822502
1 parent 55b29fe commit b760ab0

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

SwiftCompilerSources/Sources/Optimizer/FunctionPasses/DeadStoreElimination.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ private extension Deallocation {
256256

257257
private extension DeallocStackInst {
258258
func isStackDeallocation(of base: AccessBase) -> Bool {
259-
if case .stack(let allocStack) = base, allocstack == allocStack {
259+
if case .stack(let allocStack) = base, operand.value == allocStack {
260260
return true
261261
}
262262
return false

SwiftCompilerSources/Sources/SIL/Instruction.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -647,11 +647,7 @@ extension Deallocation {
647647
}
648648

649649

650-
final public class DeallocStackInst : Instruction, UnaryInstruction, Deallocation {
651-
public var allocstack: AllocStackInst {
652-
return operand.value as! AllocStackInst
653-
}
654-
}
650+
final public class DeallocStackInst : Instruction, UnaryInstruction, Deallocation {}
655651

656652
final public class DeallocStackRefInst : Instruction, UnaryInstruction, Deallocation {
657653
public var allocRef: AllocRefInstBase { operand.value as! AllocRefInstBase }

0 commit comments

Comments
 (0)