Skip to content

Commit 74fa0bc

Browse files
committed
Disable generic inlining and partial specialization, except in libswiftCore
This avoids code size regressions in programs while still getting the performance improvements in generic code in the stdlib. rdar://problem/32277313
1 parent eae2113 commit 74fa0bc

10 files changed

+13
-10
lines changed

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

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

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

3737
//===----------------------------------------------------------------------===//

lib/SILOptimizer/Utils/Generics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ using namespace swift;
2424

2525
/// Set to true to enable the support for partial specialization.
2626
llvm::cl::opt<bool> EnablePartialSpecialization(
27-
"sil-partial-specialization", llvm::cl::init(true),
27+
"sil-partial-specialization", llvm::cl::init(false),
2828
llvm::cl::desc("Enable partial specialization of generics"));
2929

3030
/// If set, then generic specialization tries to specialize using

stdlib/public/core/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,9 @@ if(SWIFT_STDLIB_SIL_DEBUGGING)
220220
list(APPEND swift_stdlib_compile_flags "-Xfrontend" "-gsil")
221221
endif()
222222

223+
list(APPEND swift_stdlib_compile_flags "-Xllvm" "-sil-inline-generics")
224+
list(APPEND swift_stdlib_compile_flags "-Xllvm" "-sil-partial-specialization")
225+
223226
if(SWIFT_CHECK_ESSENTIAL_STDLIB)
224227
add_swift_library(swift_stdlib_essential ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STDLIB IS_STDLIB_CORE
225228
${SWIFTLIB_ESSENTIAL})

test/SILOptimizer/devirt_specialized_inherited_interplay.swift

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

33
// This file consists of tests for making sure that protocol conformances and
44
// inherited conformances work well together when applied to each other. The

test/SILOptimizer/devirt_unbound_generic.swift

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

33
// We used to crash on this when trying to devirtualize t.boo(a, 1),
44
// because it is an "apply" with replacement types that contain

test/SILOptimizer/functionsigopts.sil

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck %s
2-
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck -check-prefix=CHECK-NEGATIVE %s
1+
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -sil-inline-generics -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck %s
2+
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -sil-inline-generics -enable-sil-verify-all -inline -function-signature-opts %s | %FileCheck -check-prefix=CHECK-NEGATIVE %s
33

44
import Builtin
55
import Swift

test/SILOptimizer/opened_archetype_operands_tracking.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all %s -O | %FileCheck %s
1+
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -sil-inline-generics -enable-sil-verify-all %s -O | %FileCheck %s
22

33
// Check some corner cases related to tracking of opened archetypes.
44
// For example, the compiler used to crash compiling the "process" function (rdar://28024272)

test/SILOptimizer/partial_specialization.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -generic-specializer -sil-partial-specialization-with-generic-substitutions %s | %FileCheck %s
1+
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -generic-specializer -sil-partial-specialization -sil-partial-specialization-with-generic-substitutions %s | %FileCheck %s
22

33
// Test different cases of partial specialization.
44
// In particular, test the correctness of partial specializaitons where substitutions may be generic.

test/SILOptimizer/specialize.sil

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -generic-specializer %s | %FileCheck %s
1+
// RUN: %target-sil-opt -assume-parsing-unqualified-ownership-sil -enable-sil-verify-all -sil-partial-specialization -generic-specializer %s | %FileCheck %s
22

33
sil_stage canonical
44

test/SILOptimizer/specialize_dynamic_self.swift

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

33
protocol P {}
44

0 commit comments

Comments
 (0)