Skip to content

Commit b627983

Browse files
committed
[Optimizer] Don't walk from deleted.
During inlining, the apply is deleted. So when publishing this best effort list of which instructions were "changed" during inlining, start from the instruction before the deleted apply.
1 parent c17027a commit b627983

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

SwiftCompilerSources/Sources/Optimizer/PassManager/ContextCommon.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ extension MutatingContext {
9696
func inlineFunction(apply: FullApplySite, mandatoryInline: Bool) {
9797
// This is only a best-effort attempt to notify the new cloned instructions as changed.
9898
// TODO: get a list of cloned instructions from the `inlineFunction`
99+
let instBeforeInlining = apply.previous
99100
let instAfterInlining: Instruction?
100101
switch apply {
101102
case is ApplyInst:
@@ -111,8 +112,9 @@ extension MutatingContext {
111112

112113
bridgedPassContext.inlineFunction(apply.bridged, mandatoryInline)
113114

114-
if let instAfterInlining = instAfterInlining {
115-
notifyNewInstructions(from: apply, to: instAfterInlining)
115+
if let instBeforeInlining = instBeforeInlining?.next,
116+
let instAfterInlining = instAfterInlining {
117+
notifyNewInstructions(from: instBeforeInlining, to: instAfterInlining)
116118
}
117119
}
118120

0 commit comments

Comments
 (0)