File tree 2 files changed +18
-3
lines changed
lib/SILOptimizer/PassManager
2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -760,6 +760,9 @@ static void addLowLevelPassPipeline(SILPassPipelinePlan &P) {
760
760
P.addObjectOutliner ();
761
761
P.addDeadStoreElimination ();
762
762
763
+ // dead-store-elimination can expose opportunities for dead object elimination.
764
+ P.addDeadObjectElimination ();
765
+
763
766
// We've done a lot of optimizations on this function, attempt to FSO.
764
767
P.addFunctionSignatureOpts ();
765
768
P.addComputeEscapeEffects ();
Original file line number Diff line number Diff line change @@ -19,14 +19,26 @@ func g<T : P>(_ x : T) -> Bool {
19
19
20
20
// Check that this function can be completely constant folded and no alloc_stack remains.
21
21
22
- // CHECK-LABEL: sil @$s16dead_alloc_stack6testitySbAA1XVF
22
+ // CHECK-LABEL: sil @$s10dead_alloc0A10AllocStackySbAA1XVF :
23
23
// CHECK: bb0({{.*}}):
24
24
// CHECK-NEXT: debug_value
25
25
// CHECK-NEXT: integer_literal
26
26
// CHECK-NEXT: struct
27
27
// CHECK-NEXT: return
28
- // CHECK-NEXT: } // end sil function '$s16dead_alloc_stack6testitySbAA1XVF '
29
- public func testit ( _ x: X ) -> Bool {
28
+ // CHECK-NEXT: } // end sil function '$s10dead_alloc0A10AllocStackySbAA1XVF '
29
+ public func deadAllocStack ( _ x: X ) -> Bool {
30
30
return g ( x)
31
31
}
32
32
33
+ public class C < T> {
34
+ let x : String = " 123 "
35
+ }
36
+
37
+ // CHECK-LABEL: sil @$s10dead_alloc0A13ClassInstanceyyF :
38
+ // CHECK: bb0:
39
+ // CHECK-NEXT: tuple
40
+ // CHECK-NEXT: return
41
+ // CHECK-NEXT: } // end sil function '$s10dead_alloc0A13ClassInstanceyyF'
42
+ public func deadClassInstance( ) {
43
+ let _ = C < Int > ( )
44
+ }
You can’t perform that action at this time.
0 commit comments