Skip to content

Commit 85210a4

Browse files
committed
Swift Optimizer: make some SILCombine optimizations available for the "Simplification" pass
* begin_cow_mutation * global_value * strong_retain and strong_release So far, those simplifications did only run in SILCombine. Now they are also considered in the swift Simplification pass.
1 parent 1c70060 commit 85210a4

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyBeginCOWMutation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import SIL
1414

15-
extension BeginCOWMutationInst : SILCombineSimplifyable {
15+
extension BeginCOWMutationInst : Simplifyable, SILCombineSimplifyable {
1616
func simplify(_ context: SimplifyContext) {
1717

1818
/// The buffer of an empty Array/Set/Dictionary singleton is known to be not

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyGlobalValue.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import SIL
1818
// Note that `simplifyStrongRetainPass` and `simplifyStrongReleasePass` can
1919
// even remove "unbalanced" retains/releases of a `global_value`, but this
2020
// requires a minimum deployment target.
21-
extension GlobalValueInst : SILCombineSimplifyable {
21+
extension GlobalValueInst : Simplifyable, SILCombineSimplifyable {
2222
func simplify(_ context: SimplifyContext) {
2323
var users = Stack<Instruction>(context)
2424
defer { users.deinitialize() }

SwiftCompilerSources/Sources/Optimizer/InstructionSimplification/SimplifyStrongRetainRelease.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import SIL
1414

15-
extension StrongRetainInst : SILCombineSimplifyable {
15+
extension StrongRetainInst : Simplifyable, SILCombineSimplifyable {
1616
func simplify(_ context: SimplifyContext) {
1717
if isNotReferenceCounted(value: operand) {
1818
context.erase(instruction: self)
@@ -44,7 +44,7 @@ extension StrongRetainInst : SILCombineSimplifyable {
4444
}
4545
}
4646

47-
extension StrongReleaseInst : SILCombineSimplifyable {
47+
extension StrongReleaseInst : Simplifyable, SILCombineSimplifyable {
4848
func simplify(_ context: SimplifyContext) {
4949
let op = operand
5050
if isNotReferenceCounted(value: op) {

0 commit comments

Comments
 (0)