We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b642d77 commit 796554fCopy full SHA for 796554f
SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyKeyPath.swift
@@ -15,6 +15,14 @@ import SIL
15
extension KeyPathInst : OnoneSimplifyable {
16
func simplify(_ context: SimplifyContext) {
17
if allUsesRemovable(instruction: self) {
18
+ if parentFunction.hasOwnership {
19
+ let builder = Builder(after: self, context)
20
+ for operand in self.operands {
21
+ if !operand.value.type.isTrivial(in: parentFunction) {
22
+ builder.createDestroyValue(operand: operand.value)
23
+ }
24
25
26
context.erase(instructionIncludingAllUsers: self)
27
}
28
0 commit comments