Skip to content

Commit 96f92a9

Browse files
authored
Merge pull request #7660 from swiftix/wip-generics-inlining-flag-8
2 parents c62ec0c + b21f781 commit 96f92a9

8 files changed

+15
-11
lines changed

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ llvm::cl::opt<bool> PrintShortestPathInfo(
3030
llvm::cl::desc("Print shortest-path information for inlining"));
3131

3232
llvm::cl::opt<bool> EnableSILInliningOfGenerics(
33-
"sil-inline-generics", llvm::cl::init(false),
33+
"sil-inline-generics", llvm::cl::init(true),
3434
llvm::cl::desc("Enable inlining of generics"));
3535

3636
//===----------------------------------------------------------------------===//

test/SILGen/collection_cast_crash.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -O -primary-file %s -emit-sil -o - | %FileCheck %s
1+
// RUN: %target-swift-frontend -O -Xllvm -sil-inline-generics=false -primary-file %s -emit-sil -o - | %FileCheck %s
22

33
// check if the compiler does not crash if a function is specialized
44
// which contains a collection cast

test/SILOptimizer/devirt_covariant_return.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests -Xllvm -sil-full-demangle -O -Xllvm -disable-sil-cm-rr-cm=0 -primary-file %s -emit-sil -sil-inline-threshold 1000 -sil-verify-all | %FileCheck %s
1+
// RUN: %target-swift-frontend -Xllvm -new-mangling-for-tests -Xllvm -sil-full-demangle -O -Xllvm -disable-sil-cm-rr-cm=0 -Xllvm -sil-inline-generics=false -primary-file %s -emit-sil -sil-inline-threshold 1000 -sil-verify-all | %FileCheck %s
22

33
// Make sure that we can dig all the way through the class hierarchy and
44
// protocol conformances with covariant return types correctly. The verifier

test/SILOptimizer/devirt_protocol_method_invocations.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,13 @@ protocol MathP {
178178
}
179179

180180
extension MathP {
181+
@inline(never)
181182
func plus() -> Self {
182183
sum += 1
183184
return self
184185
}
185186

187+
@inline(never)
186188
func minus() {
187189
sum -= 1
188190
if sum == 0 {

test/SILOptimizer/devirt_specialized_conformance.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend -O %s -emit-sil -sil-verify-all | %FileCheck %s
1+
// RUN: %target-swift-frontend -O -Xllvm -sil-inline-generics=false %s -emit-sil -sil-verify-all | %FileCheck %s
22

33
// Make sure that we completely inline/devirtualize/substitute all the way down
44
// to unknown1.

test/SILOptimizer/devirt_unbound_generic.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ class Derived<T> : Base<T> {
4646
// Derived has no subclasses and it is a WMO compilation.
4747
// CHECK: sil hidden [noinline] @_T022devirt_unbound_generic5test2yAA7DerivedCyxGlF
4848
// CHECK-NOT: class_method
49-
// CHECK: function_ref @_T022devirt_unbound_generic7DerivedC3fooyyF
50-
// CHECK-NOT: class_method
49+
// CHECK-NOT: witness_method
50+
// CHECK-NOT: apply
5151
// CHECK: return
52+
// CHEC: end sil function '_T022devirt_unbound_generic5test2yAA7DerivedCyxGlF'
5253
@inline(never)
5354
func test2<T>(_ d: Derived<T>) {
5455
d.foo()
@@ -62,9 +63,10 @@ public func doTest2<T>(_ t:T) {
6263
// Derived has no subclasses and it is a WMO compilation.
6364
// CHECK: sil hidden [noinline] @_T022devirt_unbound_generic5test3yAA7DerivedCyxGlF
6465
// CHECK-NOT: class_method
65-
// CHECK: function_ref @_T022devirt_unbound_generic7DerivedC3booyyFZ
66-
// CHECK-NOT: class_method
66+
// CHECK-NOT: witness_method
67+
// CHECK-NOT: apply
6768
// CHECK: return
69+
// CHECK: end sil function '_T022devirt_unbound_generic5test3yAA7DerivedCyxGlF'
6870
@inline(never)
6971
func test3<T>(_ d: Derived<T>) {
7072
type(of: d).boo()

test/SILOptimizer/opened_archetype_operands_tracking.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension P {
1818

1919
public func process(s: P)
2020

21-
sil @invokeClosure : $@convention(method) <Self where Self : P> (@owned @callee_owned () -> @error Error, @in_guaranteed Self) -> @error Error {
21+
sil [noinline] @invokeClosure : $@convention(method) <Self where Self : P> (@owned @callee_owned () -> @error Error, @in_guaranteed Self) -> @error Error {
2222
bb0(%0 : $@callee_owned () -> @error Error, %1 : $*Self):
2323
strong_release %0 : $@callee_owned () -> @error Error
2424
%5 = tuple ()

test/SILOptimizer/prespecialize.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-swift-frontend %s -Onone -emit-sil | %FileCheck %s
1+
// RUN: %target-swift-frontend %s -Onone -Xllvm -sil-inline-generics=false -emit-sil | %FileCheck %s
22

33
// REQUIRES: optimized_stdlib
44

@@ -11,7 +11,7 @@
1111
// CHECK-LABEL: sil [noinline] @_TF13prespecialize4testFTRGSaSi_4sizeSi_T_
1212
//
1313
// function_ref specialized Collection<A where ...>.makeIterator() -> IndexingIterator<A>
14-
// CHECK: function_ref @_TTSgq5SiSis10ComparablesSis11_Strideables___TFVs14CountableRangeCfT15uncheckedBoundsT5lowerx5upperx__GS_x_
14+
// CHECK: function_ref @_TTSgq5GVs14CountableRangeSi_GS_Si_s10Collections___TFesRxs10Collectionwx8IteratorzGVs16IndexingIteratorx_rS_12makeIteratorfT_GS1_x_
1515
//
1616
// function_ref specialized IndexingIterator.next() -> A._Element?
1717
// CHECK: function_ref @_TTSgq5GVs14CountableRangeSi_GS_Si_s14_IndexableBases___TFVs16IndexingIterator4nextfT_GSqwx8_Element_

0 commit comments

Comments
 (0)