@@ -96,23 +96,26 @@ 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 instAfterInling : Instruction ?
99+ let instBeforeInlining = apply. previous
100+ let instAfterInlining : Instruction ?
100101 switch apply {
101102 case is ApplyInst :
102- instAfterInling = apply. next
103+ instAfterInlining = apply. next
103104 case let beginApply as BeginApplyInst :
104105 let next = beginApply. next!
105- instAfterInling = ( next is EndApplyInst ? nil : next)
106+ instAfterInlining = ( next is EndApplyInst ? nil : next)
106107 case is TryApplyInst :
107- instAfterInling = apply. parentBlock. next? . instructions. first
108+ instAfterInlining = apply. parentBlock. next? . instructions. first
108109 default :
109- instAfterInling = nil
110+ instAfterInlining = nil
110111 }
111112
112113 bridgedPassContext. inlineFunction ( apply. bridged, mandatoryInline)
113114
114- if let instAfterInling = instAfterInling {
115- notifyNewInstructions ( from: apply, to: instAfterInling)
115+ if let instBeforeInlining = instBeforeInlining? . next,
116+ let instAfterInlining = instAfterInlining,
117+ !instAfterInlining. isDeleted {
118+ notifyNewInstructions ( from: instBeforeInlining, to: instAfterInlining)
116119 }
117120 }
118121
0 commit comments