Skip to content

Commit fa17b2e

Browse files
authored
---
yaml --- r: 303039 b: refs/heads/tensorflow c: 46b5af5 h: refs/heads/master i: 303037: 3e703f2 303035: a1c3150 303031: 05d1230 303023: 90a7049 303007: adc672e 302975: 9b2cd1b
1 parent 3067ad6 commit fa17b2e

File tree

252 files changed

+4715
-2459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

252 files changed

+4715
-2459
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -816,7 +816,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-04-25-a: 22f738a831d43aff2b9c9773bcb65
816816
refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-05-08-a: 7d98cc16689baba5c8a3b90a9329bdcc1a12b4e9
817817
refs/heads/cherr42: a566ad54b073c2c56ac0a705d0a5bed9743135a5
818818
"refs/heads/codable_test_comment_fix": fc8f6824f7f347e1e8db55bff62db385c5728b5a
819-
refs/heads/tensorflow: de1718ed1beb91743006f6b98ef4111186e7bbf6
819+
refs/heads/tensorflow: 46b5af59df707763ec782d6099586dd67a5da0b6
820820
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-11-a: 8126fd7a652e2f70ad6d76505239e34fb2ef3e1a
821821
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-12-a: b3fd3dd84df6717f2e2e9df58c6d7e99fed57086
822822
refs/tags/swift-4.1-DEVELOPMENT-SNAPSHOT-2018-05-13-a: 71135119579039dc321c5f65d870050fe36efda2

branches/tensorflow/docs/CompilerPerformance.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,6 @@ $ cat /tmp/stats/*.json
717717
"AST.NumSourceLinesPerSecond": 3,
718718
"AST.NumLinkLibraries": 0,
719719
"AST.NumLoadedModules": 4,
720-
"AST.NumImportedExternalDefinitions": 0,
721720
"AST.NumTotalClangImportedEntities": 0,
722721
...
723722
"time.swift.Parsing.wall": 5.038023e-03,

branches/tensorflow/docs/DebuggingTheCompiler.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,44 @@ One can also use shell regex to visit multiple files in the same directory. Exam
457457

458458
clang-tidy -p=$PATH_TO_BUILD/swift-macosx-x86_64/compile_commands.json $FULL_PATH_TO_DIR/*.cpp
459459

460+
Identifying an optimizer bug
461+
----------------------------
462+
463+
If a compiled executable is crashing when built with optimizations, but not
464+
crashing when built with -Onone, it's most likely one of the SIL optimizations
465+
which causes the miscompile.
466+
467+
Currently there is no tool to automatically identify the bad optimization, but
468+
it's quite easy to do this manually:
469+
470+
1. Find the offending optimization with bisecting:
471+
472+
a. Add the compiler option ``-Xllvm -sil-opt-pass-count=<n>``, where ``<n>``
473+
is the number of optimizations to run.
474+
b. Bisect: find n where the executable crashes, but does not crash with n-1.
475+
Note that n can be quite large, e.g. > 100000 (just try
476+
n = 10, 100, 1000, 10000, etc. to find an upper bound).
477+
c. Add another option ``-Xllvm -sil-print-pass-name``. The output can be
478+
large, so it's best to redirect stderr to a file (``2> output``).
479+
In the output search for the last pass before ``stage Address Lowering``.
480+
It should be the ``Run #<n-1>``. This line tells you the name of the bad
481+
optimization pass and on which function it run.
482+
483+
2. Get the SIL before and after the bad optimization.
484+
485+
a. Add the compiler options
486+
``-Xllvm -sil-print-all -Xllvm -sil-print-only-function='<function>'``
487+
where ``<function>`` is the function name (including the preceding ``$``).
488+
For example:
489+
``-Xllvm -sil-print-all -Xllvm -sil-print-only-function='$s4test6testityS2iF'``.
490+
Again, the output can be large, so it's best to redirect stderr to a file.
491+
b. From the output, copy the SIL of the function *before* the bad
492+
run into a separate file and the SIL *after* the bad run into a file.
493+
c. Compare both SIL files and try to figure out what the optimization pass
494+
did wrong. To simplify the comparison, it's sometimes helpful to replace
495+
all SIL values (e.g. ``%27``) with a constant string (e.g. ``%x``).
496+
497+
460498
Debugging Swift Executables
461499
===========================
462500

branches/tensorflow/docs/SIL.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2333,15 +2333,15 @@ with a sequence that also correctly destroys the current value.
23332333
This instruction is only valid in Raw SIL and is rewritten as appropriate
23342334
by the definitive initialization pass.
23352335

2336-
assign_by_delegate
2336+
assign_by_wrapper
23372337
``````````````````
23382338
::
23392339

2340-
sil-instruction ::= 'assign_by_delegate' sil-operand 'to' sil-operand ',' 'init' sil-operand ',' 'set' sil-operand
2340+
sil-instruction ::= 'assign_by_wrapper' sil-operand 'to' sil-operand ',' 'init' sil-operand ',' 'set' sil-operand
23412341

2342-
assign_by_delegate %0 : $S to %1 : $*T, init %2 : $F, set %3 : $G
2342+
assign_by_wrapper %0 : $S to %1 : $*T, init %2 : $F, set %3 : $G
23432343
// $S can be a value or address type
2344-
// $T must be the type of a property delegate.
2344+
// $T must be the type of a property wrapper.
23452345
// $F must be a function type, taking $S as a single argument and returning $T
23462346
// $G must be a function type, taking $S as a single argument and with not return value
23472347

branches/tensorflow/docs/WindowsBuild.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ cmake -G Ninja^
158158
-DLLVM_DIR=S:\b\llvm\lib\cmake\llvm^
159159
-DClang_DIR=S:\b\llvm\lib\cmake\clang^
160160
-DSWIFT_PATH_TO_LIBDISPATCH_SOURCE="S:\swift-corelibs-libdispatch"^
161-
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/thirdparty/icu4c-63_1-Win64-MSVC2017/include"^
162-
-DSWIFT_WINDOWS_x86_64_ICU_UC="S:/thirdparty/icu4c-63_1-Win64-MSVC2017/lib64/icuuc.lib"^
163-
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/thirdparty/icu4c-63_1-Win64-MSVC2017/include"^
164-
-DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/thirdparty/icu4c-63_1-Win64-MSVC2017/lib64/icuin.lib"^
161+
-DSWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/include"^
162+
-DSWIFT_WINDOWS_x86_64_ICU_UC="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/lib64/icuuc.lib"^
163+
-DSWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/include"^
164+
-DSWIFT_WINDOWS_x86_64_ICU_I18N="S:/thirdparty/icu4c-64_2-Win64-MSVC2017/lib64/icuin.lib"^
165165
-DCMAKE_INSTALL_PREFIX="C:\Library\Developer\Toolchains\unknown-Asserts-development.xctoolchain\usr"^
166166
-DPYTHON_EXECUTABLE=C:\Python27\python.exe^
167167
S:\swift
@@ -258,7 +258,7 @@ cmake -G Ninja^
258258
-DCURL_LIBRARY="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/lib/libcurl_a.lib"^
259259
-DCURL_INCLUDE_DIR="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/include"^
260260
-DENABLE_TESTING=NO^
261-
-DICU_ROOT="S:/thirdparty/icu4c-63_1-Win64-MSVC2017"^
261+
-DICU_ROOT="S:/thirdparty/icu4c-64_2-Win64-MSVC2017"^
262262
-DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a.lib"^
263263
-DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
264264
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^
@@ -312,7 +312,7 @@ cmake -G Ninja^
312312
-DCURL_LIBRARY="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/lib/libcurl_a.lib"^
313313
-DCURL_INCLUDE_DIR="S:/curl/builds/libcurl-vc15-x64-release-static-ipv6-sspi-winssl/include"^
314314
-DENABLE_TESTING=YES^
315-
-DICU_ROOT="S:/thirdparty/icu4c-63_1-Win64-MSVC2017"^
315+
-DICU_ROOT="S:/thirdparty/icu4c-64_2-Win64-MSVC2017"^
316316
-DLIBXML2_LIBRARY="S:/libxml2/win32/bin.msvc/libxml2_a.lib"^
317317
-DLIBXML2_INCLUDE_DIR="S:/libxml2/include"^
318318
-DFOUNDATION_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch^

branches/tensorflow/include/swift/AST/ASTContext.h

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -255,13 +255,6 @@ class ASTContext final {
255255
#define IDENTIFIER_WITH_NAME(Name, IdStr) Identifier Id_##Name;
256256
#include "swift/AST/KnownIdentifiers.def"
257257

258-
/// The list of external definitions imported by this context.
259-
llvm::SetVector<Decl *> ExternalDefinitions;
260-
261-
/// FIXME: HACK HACK HACK
262-
/// This state should be tracked somewhere else.
263-
unsigned LastCheckedExternalDefinition = 0;
264-
265258
/// A consumer of type checker debug output.
266259
std::unique_ptr<TypeCheckerDebugConsumer> TypeCheckerDebug;
267260

@@ -580,14 +573,8 @@ class ASTContext final {
580573
ForeignLanguage language,
581574
const DeclContext *dc);
582575

583-
/// Add a declaration to a list of declarations that need to be emitted
584-
/// as part of the current module or source file, but are otherwise not
585-
/// nested within it.
586-
void addExternalDecl(Decl *decl);
587-
588576
/// Add a declaration that was synthesized to a per-source file list if
589-
/// if is part of a source file, or the external declarations list if
590-
/// it is part of an imported type context.
577+
/// if is part of a source file.
591578
void addSynthesizedDecl(Decl *decl);
592579

593580
/// Add a cleanup function to be called when the ASTContext is deallocated.
@@ -851,11 +838,11 @@ class ASTContext final {
851838
const IterableDeclContext *idc,
852839
LazyMemberLoader *lazyLoader);
853840

854-
/// Access the side cache for property delegate backing property types,
841+
/// Access the side cache for property wrapper backing property types,
855842
/// used because TypeChecker::typeCheckBinding() needs somewhere to stash
856843
/// the backing property type.
857-
Type getSideCachedPropertyDelegateBackingPropertyType(VarDecl *var) const;
858-
void setSideCachedPropertyDelegateBackingPropertyType(VarDecl *var,
844+
Type getSideCachedPropertyWrapperBackingPropertyType(VarDecl *var) const;
845+
void setSideCachedPropertyWrapperBackingPropertyType(VarDecl *var,
859846
Type type);
860847

861848
/// Returns memory usage of this ASTContext.

branches/tensorflow/include/swift/AST/ASTTypeIDZone.def

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
SWIFT_TYPEID_NAMED(NominalTypeDecl *, NominalTypeDecl)
1818
SWIFT_TYPEID_NAMED(VarDecl *, VarDecl)
1919
SWIFT_TYPEID(Type)
20-
SWIFT_TYPEID(PropertyDelegateBackingPropertyInfo)
21-
SWIFT_TYPEID(PropertyDelegateTypeInfo)
20+
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfo)
21+
SWIFT_TYPEID(PropertyWrapperTypeInfo)
2222
SWIFT_TYPEID_NAMED(CustomAttr *, CustomAttr)
2323
SWIFT_TYPEID_NAMED(TypeAliasDecl *, TypeAliasDecl)

branches/tensorflow/include/swift/AST/ASTTypeIDs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ namespace swift {
2222

2323
class CustomAttr;
2424
class NominalTypeDecl;
25-
struct PropertyDelegateBackingPropertyInfo;
26-
struct PropertyDelegateTypeInfo;
25+
struct PropertyWrapperBackingPropertyInfo;
26+
struct PropertyWrapperTypeInfo;
2727
class Type;
2828
class VarDecl;
2929
class TypeAliasDecl;

branches/tensorflow/include/swift/AST/Attr.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ SIMPLE_DECL_ATTR(_implementationOnly, ImplementationOnly,
399399
DECL_ATTR(_custom, Custom,
400400
OnAnyDecl | UserInaccessible,
401401
85)
402-
SIMPLE_DECL_ATTR(_propertyDelegate, PropertyDelegate,
402+
SIMPLE_DECL_ATTR(_propertyWrapper, PropertyWrapper,
403403
OnStruct | OnClass | OnEnum,
404404
86)
405405
SIMPLE_DECL_ATTR(_disfavoredOverload, DisfavoredOverload,

branches/tensorflow/include/swift/AST/Decl.h

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,8 @@ namespace swift {
7878
class ParameterTypeFlags;
7979
class Pattern;
8080
struct PrintOptions;
81-
struct PropertyDelegateBackingPropertyInfo;
82-
struct PropertyDelegateTypeInfo;
81+
struct PropertyWrapperBackingPropertyInfo;
82+
struct PropertyWrapperTypeInfo;
8383
class ProtocolDecl;
8484
class ProtocolType;
8585
struct RawComment;
@@ -391,8 +391,8 @@ class alignas(1 << DeclAlignInBits) Decl {
391391
/// FIXME: Remove this once LLDB has proper support for resilience.
392392
IsREPLVar : 1,
393393

394-
/// Whether this is the backing storage for a property delegate.
395-
IsPropertyDelegateBackingProperty : 1
394+
/// Whether this is the backing storage for a property wrapper.
395+
IsPropertyWrapperBackingProperty : 1
396396
);
397397

398398
SWIFT_INLINE_BITFIELD(ParamDecl, VarDecl, 1 + NumDefaultArgumentKindBits,
@@ -3394,8 +3394,8 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
33943394
/// Is this a key path type?
33953395
Optional<KeyPathTypeKind> getKeyPathTypeKind() const;
33963396

3397-
/// Retrieve information about this type as a property delegate.
3398-
PropertyDelegateTypeInfo getPropertyDelegateTypeInfo() const;
3397+
/// Retrieve information about this type as a property wrapper.
3398+
PropertyWrapperTypeInfo getPropertyWrapperTypeInfo() const;
33993399

34003400
private:
34013401
/// Predicate used to filter StoredPropertyRange.
@@ -4745,14 +4745,14 @@ class AbstractStorageDecl : public ValueDecl {
47454745
};
47464746

47474747
/// Describes which synthesized property for a property with an attached
4748-
/// delegate is being referenced.
4749-
enum class PropertyDelegateSynthesizedPropertyKind {
4748+
/// wrapper is being referenced.
4749+
enum class PropertyWrapperSynthesizedPropertyKind {
47504750
/// The backing storage property, which is a stored property of the
4751-
/// delegate type.
4751+
/// wrapper type.
47524752
Backing,
4753-
/// A storage delegate (e.g., `$foo`), which is a wrapper over the
4754-
/// delegate instance's `delegateValue` property.
4755-
StorageDelegate,
4753+
/// A storage wrapper (e.g., `$foo`), which is a wrapper over the
4754+
/// wrapper instance's `wrapperValue` property.
4755+
StorageWrapper,
47564756
};
47574757

47584758
/// VarDecl - 'var' and 'let' declarations.
@@ -4785,7 +4785,7 @@ class VarDecl : public AbstractStorageDecl {
47854785
Bits.VarDecl.IsDebuggerVar = false;
47864786
Bits.VarDecl.IsREPLVar = false;
47874787
Bits.VarDecl.HasNonPatternBindingInit = false;
4788-
Bits.VarDecl.IsPropertyDelegateBackingProperty = false;
4788+
Bits.VarDecl.IsPropertyWrapperBackingProperty = false;
47894789
}
47904790

47914791
/// This is the type specified, including location information.
@@ -5080,64 +5080,64 @@ class VarDecl : public AbstractStorageDecl {
50805080
Bits.VarDecl.IsREPLVar = IsREPLVar;
50815081
}
50825082

5083-
/// Retrieve the custom attribute that attaches a property delegate to this
5083+
/// Retrieve the custom attribute that attaches a property wrapper to this
50845084
/// property.
5085-
CustomAttr *getAttachedPropertyDelegate() const;
5085+
CustomAttr *getAttachedPropertyWrapper() const;
50865086

5087-
/// Retrieve the type of the attached property delegate as a contextual
5087+
/// Retrieve the type of the attached property wrapper as a contextual
50885088
/// type.
50895089
///
5090-
/// \returns a NULL type for properties without attached delegates,
5091-
/// an error type when the property delegate type itself is erroneous,
5092-
/// or the delegate type itself, which may involve unbound generic
5090+
/// \returns a NULL type for properties without attached wrappers,
5091+
/// an error type when the property wrapper type itself is erroneous,
5092+
/// or the wrapper type itself, which may involve unbound generic
50935093
/// types.
5094-
Type getAttachedPropertyDelegateType() const;
5094+
Type getAttachedPropertyWrapperType() const;
50955095

5096-
/// Retrieve information about the attached property delegate type.
5097-
PropertyDelegateTypeInfo getAttachedPropertyDelegateTypeInfo() const;
5096+
/// Retrieve information about the attached property wrapper type.
5097+
PropertyWrapperTypeInfo getAttachedPropertyWrapperTypeInfo() const;
50985098

5099-
/// Retrieve the fully resolved attached property delegate type.
5099+
/// Retrieve the fully resolved attached property wrapper type.
51005100
///
51015101
/// This type will be the fully-resolved form of
5102-
/// \c getAttachedPropertyDelegateType(), which will not contain any
5102+
/// \c getAttachedPropertyWrapperType(), which will not contain any
51035103
/// unbound generic types. It will be the type of the backing property.
5104-
Type getPropertyDelegateBackingPropertyType() const;
5104+
Type getPropertyWrapperBackingPropertyType() const;
51055105

51065106
/// Retrieve information about the backing properties of the attached
5107-
/// property delegate.
5108-
PropertyDelegateBackingPropertyInfo
5109-
getPropertyDelegateBackingPropertyInfo() const;
5107+
/// property wrapper.
5108+
PropertyWrapperBackingPropertyInfo
5109+
getPropertyWrapperBackingPropertyInfo() const;
51105110

51115111
/// Retrieve the backing storage property for a property that has an
5112-
/// attached property delegate.
5112+
/// attached property wrapper.
51135113
///
51145114
/// The backing storage property will be a stored property of the
5115-
/// delegate's type. This will be equivalent to
5116-
/// \c getAttachedPropertyDelegateType() when it is fully-specified;
5117-
/// if \c getAttachedPropertyDelegateType() involves an unbound
5115+
/// wrapper's type. This will be equivalent to
5116+
/// \c getAttachedPropertyWrapperType() when it is fully-specified;
5117+
/// if \c getAttachedPropertyWrapperType() involves an unbound
51185118
/// generic type, the backing storage property will be the appropriate
51195119
/// bound generic version.
5120-
VarDecl *getPropertyDelegateBackingProperty() const;
5120+
VarDecl *getPropertyWrapperBackingProperty() const;
51215121

5122-
/// Whether this is a property with a property delegate that was initialized
5122+
/// Whether this is a property with a property wrapper that was initialized
51235123
/// via a value of the original type, e.g.,
51245124
///
51255125
/// \code
51265126
/// @Lazy var i = 17
51275127
/// \end
5128-
bool isPropertyDelegateInitializedWithInitialValue() const;
5128+
bool isPropertyWrapperInitializedWithInitialValue() const;
51295129

51305130
/// If this property is the backing storage for a property with an attached
5131-
/// property delegate, return the original property.
5131+
/// property wrapper, return the original property.
51325132
///
51335133
/// \param kind If not \c None, only returns the original property when
51345134
/// \c this property is the specified synthesized property.
5135-
VarDecl *getOriginalDelegatedProperty(
5136-
Optional<PropertyDelegateSynthesizedPropertyKind> kind = None) const;
5135+
VarDecl *getOriginalWrappedProperty(
5136+
Optional<PropertyWrapperSynthesizedPropertyKind> kind = None) const;
51375137

5138-
/// Set the property that delegates to this property as it's backing
5138+
/// Set the property that wraps to this property as it's backing
51395139
/// property.
5140-
void setOriginalDelegatedProperty(VarDecl *originalProperty);
5140+
void setOriginalWrappedProperty(VarDecl *originalProperty);
51415141

51425142
/// Return the Objective-C runtime name for this property.
51435143
Identifier getObjCPropertyName() const;
@@ -5164,7 +5164,7 @@ class VarDecl : public AbstractStorageDecl {
51645164
/// initializer.
51655165
///
51665166
/// \param preferDeclaredProperties When encountering a `lazy` property
5167-
/// or a property that has an attached property delegate, prefer the
5167+
/// or a property that has an attached property wrapper, prefer the
51685168
/// actual declared property (which may or may not be considered "stored"
51695169
/// as the moment) to the backing storage property. Otherwise, the stored
51705170
/// backing property will be treated as the member-initialized property.

0 commit comments

Comments
 (0)