Skip to content

Commit 07d7518

Browse files
committed
[Optimizer] Don't walk to deleted.
During inlining, some instructions in the caller may be deleted. So when publishing this best effort list of instructions which were "changed" during inlining, don't start from a deleted instruction. Instead just don't publish, as already happens in other cases. Without actually addressing ``` // TODO: get a list of cloned instructions from the `inlineFunction` ``` this is somewhat better than checking for having reached the end of the function during the walk because that will result in falsely broadcasting that some unchanged instructions have changed whereas this change only results in not broadcasting which is already being done in some cases (e.g. when a `begin_apply` is immediately followed by an `end_apply`).
1 parent b627983 commit 07d7518

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

SwiftCompilerSources/Sources/Optimizer/PassManager/ContextCommon.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ extension MutatingContext {
113113
bridgedPassContext.inlineFunction(apply.bridged, mandatoryInline)
114114

115115
if let instBeforeInlining = instBeforeInlining?.next,
116-
let instAfterInlining = instAfterInlining {
116+
let instAfterInlining = instAfterInlining,
117+
!instAfterInlining.isDeleted {
117118
notifyNewInstructions(from: instBeforeInlining, to: instAfterInlining)
118119
}
119120
}

validation-test/SILOptimizer/rdar161433604.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010
// REQUIRES: swift_feature_Embedded
1111
// REQUIRES: swift_feature_LifetimeDependence
1212

13-
// XFAIL: *
14-
1513
struct NoEscapeNoCopy: ~Escapable, ~Copyable {}
1614

1715
protocol Foo {

0 commit comments

Comments
 (0)