Files
swift-mirror/test/SIL/Serialization/public_external.sil
Josh Soref d767912be2 Spelling sil (#42471)
* spelling: accessible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: accessories

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: allocated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: amortizes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: are

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: arguments

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: cacheable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: check

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compatible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compilation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: completely

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: construct

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declarations

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: derivation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: deserialization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: destroyed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: determined

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: different

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: doesn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: equality

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: equivalent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: formation

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: forwards

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: global

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: guaranteed

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: have

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: identify

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inaccessible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: indeterminate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: indices

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inefficient

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: inheritance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instantaneous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: instruction

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intentionally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interior

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intrinsic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: introducing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: irrelevant

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: message

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multi

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: necessarily

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: object

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: one

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: optimization

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: otherwise

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overridden

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: parameter

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: pattern

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: pipeline

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: possibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: postdominance

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: providing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: reached

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: recognized

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: refrigerator

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: remaining

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: resilient

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: retrieve

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: scavenge

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: scheduled

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: separately

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: serializable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: signature

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplicity

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: specifically

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: substituted

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: substitution

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: subtypes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: supplement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: syntax

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: there

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: these

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: this

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: though

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: through

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transitively

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: transpose

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trivial

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: value

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: verification

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: visibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: weird

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: whole

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-22 15:11:09 -07:00

128 lines
4.7 KiB
Plaintext

// RUN: %target-swift-frontend %s -parse-sil -emit-module -module-name Swift -module-link-name swiftCore -parse-stdlib -parse-as-library -o - | %target-sil-opt -module-name Swift -emit-sorted-sil | %FileCheck %s
sil_stage raw
import Builtin
// Check that bodies are not serialized for external functions.
// CHECK-NOT: sil{{.*}}@pe : $@convention(thin) () -> () {
// CHECK-NOT: sil{{.*}}@external_pe : $@convention(thin) () -> () {
// CHECK-NOT: sil{{.*}}@he : $@convention(thin) () -> () {
// CHECK-NOT: sil{{.*}}@external_he : $@convention(thin) () -> () {
// CHECK-NOT: sil{{.*}}@se : $@convention(thin) () -> () {
// Check that declarations are not serialized for external functions that are
// not used, i.e. not referenced from serialized functions.
// CHECK-NOT: sil{{.*}}@pe : $@convention(thin) () -> ()
// CHECK-NOT: sil{{.*}}@external_pe : $@convention(thin) () -> ()
// CHECK-NOT: sil{{.*}}@he : $@convention(thin) () -> ()
// CHECK-NOT: sil{{.*}}@external_he : $@convention(thin) () -> ()
// CHECK-NOT: sil{{.*}}@se : $@convention(thin) () -> ()
// Check that declarations for shared external functions are not serialized,
// because such functions should always have a serialized body.
// CHECK-NOT: sil{{.*}}@se : $@convention(thin) () -> ()
// Some functions are marked transparent to prevent ExternalDefsToDecls opt from
// converting them into declarations.
sil public_external [serialized] @pe : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil public_external [serialized] [transparent] @transparent_pe : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden @he : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil hidden [transparent] @tranparent_he : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
sil shared @se : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// Check that external non-shared functions are serialized only
// if they are referenced from something reachable from non-external functions.
// Since all these fN functions are referenced only from an external function,
// do not serialize even their declarations.
// CHECK-NOT: sil{{.*}}@fn1 : $@convention(thin) () -> ()
sil public_external [serialized] [noinline] @fn1 : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// CHECK-NOT: sil{{.*}}@fn2: $@convention(thin) () -> ()
sil public_external [serialized] [noinline] @fn2 : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// CHECK-NOT: sil{{.*}}@fn3 : $@convention(thin) () -> ()
sil public_external [serialized] [noinline] @fn3 : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// CHECK-NOT: sil{{.*}}@fn4 : $@convention(thin) () -> ()
sil public_external [serialized] [noinline] @fn4 : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// Emit the declaration of this function, because it is referenced from serialized
// function use_external_functions.
sil public_external [serialized] [noinline] @used_external_fn : $@convention(thin) () -> () {
%0 = tuple()
return %0 : $()
}
// Do not serialize the body of this function, because it is public external.
// But emit its declaration, because it is referenced from a body of serialized
// fragile function.
// There should be no body for this function.
// CHECK-NOT: sil{{.*}}@public_external_fn : $@convention(thin) () -> () {
// But declaration should be present.
// CHECK: sil{{.*}}@public_external_fn : $@convention(thin) () -> ()
sil public_external [serialized] [noinline] @public_external_fn : $@convention(thin) () -> () {
%0 = function_ref @fn1 : $@convention(thin) () -> ()
%1 = apply %0 () : $@convention(thin) () -> ()
%2 = function_ref @fn2 : $@convention(thin) () -> ()
%3 = apply %2 () : $@convention(thin) () -> ()
%4 = function_ref @fn3 : $@convention(thin) () -> ()
%5 = apply %4 () : $@convention(thin) () -> ()
%6 = function_ref @fn4 : $@convention(thin) () -> ()
%7 = apply %6 () : $@convention(thin) () -> ()
%10 = tuple()
return %10 : $()
}
// The body of this fragile function has to be emitted.
// CHECK-LABEL: sil{{.*}}@use_external_functions : $@convention(thin) () -> () {
sil [serialized] @use_external_functions: $@convention(thin) () -> () {
%0 = function_ref @public_external_fn : $@convention(thin) () -> ()
%1 = apply %0 () : $@convention(thin) () -> ()
%2 = function_ref @used_external_fn : $@convention(thin) () -> ()
%3 = apply %2 () : $@convention(thin) () -> ()
%4 = tuple()
return %4 : $()
}
// There should be no body for this function.
// CHECK-NOT: sil{{.*}}@used_external_fn : $@convention(thin) () -> () {
// But declaration should be present.
// CHECK: sil{{.*}}@used_external_fn : $@convention(thin) () -> ()