File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -500,6 +500,11 @@ static bool createsInfiniteSpecializationLoop(ApplySite Apply) {
500
500
501
501
static bool shouldNotSpecialize (SILFunction *Callee, SILFunction *Caller,
502
502
SubstitutionMap Subs = {}) {
503
+ // Ignore "do not specialize" markers in embedded Swift -- specialization is
504
+ // mandatory.
505
+ if (Callee->getModule ().getOptions ().EmbeddedSwift )
506
+ return false ;
507
+
503
508
if (Callee->hasSemanticsAttr (semantics::OPTIMIZE_SIL_SPECIALIZE_GENERIC_NEVER))
504
509
return true ;
505
510
Original file line number Diff line number Diff line change
1
+ // RUN: %target-run-simple-swift(%S/Inputs/print.swift -parse-as-library -Onone -enable-experimental-feature Embedded -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop -Xlinker -dead_strip) | %FileCheck %s
2
+ // RUN: %target-run-simple-swift(%S/Inputs/print.swift -parse-as-library -O -enable-experimental-feature Embedded -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop -Xlinker -dead_strip) | %FileCheck %s
3
+ // RUN: %target-run-simple-swift(%S/Inputs/print.swift -parse-as-library -Osize -enable-experimental-feature Embedded -runtime-compatibility-version none -wmo -Xfrontend -disable-objc-interop -Xlinker -dead_strip) | %FileCheck %s
4
+
5
+ // REQUIRES: swift_in_compiler
6
+ // REQUIRES: executable_test
7
+ // REQUIRES: optimized_stdlib
8
+ // REQUIRES: OS=macosx
9
+
10
+ @_semantics ( " optimize.sil.specialize.generic.never " )
11
+ func foo< T> ( _ t: T ) -> Int {
12
+ return 42
13
+ }
14
+
15
+ @_semantics ( " optimize.sil.specialize.generic.size.never " )
16
+ func foo2< T> ( _ t: T ) -> Int {
17
+ return 42
18
+ }
19
+
20
+ @main
21
+ struct Main {
22
+ static func main( ) {
23
+ foo ( 42 )
24
+ foo2 ( 42 )
25
+ print ( " OK! " )
26
+ }
27
+ }
28
+
29
+ // CHECK: OK!
You can’t perform that action at this time.
0 commit comments