Skip to content

Commit 91e67ff

Browse files
committed
---
yaml --- r: 278526 b: refs/heads/swift-5.1-old-llvm-branch c: 5160da6 h: refs/heads/master
1 parent c7b7f64 commit 91e67ff

File tree

82 files changed

+597
-1056
lines changed

Some content is hidden

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

82 files changed

+597
-1056
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2019-01-24-a: b6f62823aa5010b2ae53f15f72a57
12411241
refs/heads/marcrasi-astverifier-disable: 3fac766a23a77ebd0640296bfd7fc116ea60a4e0
12421242
refs/heads/revert-22227-a-tall-white-fountain-played: adfce60b2eaa54903ea189bed8a783bca609fa53
12431243
refs/heads/revert-22300-revert-22227-a-tall-white-fountain-played: 5f92040224df7dd4e618fdfb367349df64d8acad
1244-
refs/heads/swift-5.1-old-llvm-branch: e8219a5d04f660131f3e03866be5407c8537d1ee
1244+
refs/heads/swift-5.1-old-llvm-branch: 5160da6a2e0f4c279f883dbf56ce8baf56fba30e
12451245
refs/heads/swift-5.1-branch: 8060872acb4105d9655e020fe047e1ebcd77d0fb
12461246
refs/tags/swift-4.2.2-RELEASE: e429d1f1aaf59e69d38207a96e56265c7f6fccec
12471247
refs/tags/swift-5.0-DEVELOPMENT-SNAPSHOT-2019-02-02-a: 3e5a03d32ff3b1e9af90d6c1198c14f938379a6e

branches/swift-5.1-old-llvm-branch/benchmark/single-source/ArrayInClass.swift

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,11 @@ public let ArrayInClass = [
1717
runFunction: run_ArrayInClass,
1818
tags: [.validation, .api, .Array],
1919
setUpFunction: { ac = ArrayContainer() },
20-
tearDownFunction: { ac = nil },
21-
legacyFactor: 5),
20+
tearDownFunction: { ac = nil }),
2221
BenchmarkInfo(name: "DistinctClassFieldAccesses",
2322
runFunction: run_DistinctClassFieldAccesses,
24-
tags: [.validation, .api, .Array],
25-
setUpFunction: { workload = ClassWithArrs(N: 10_000) },
23+
tags: [.unstable, .api, .Array],
24+
setUpFunction: { workload = ClassWithArrs(N: 100_000) },
2625
tearDownFunction: { workload = nil }),
2726
]
2827

@@ -32,7 +31,7 @@ class ArrayContainer {
3231
final var arr : [Int]
3332

3433
init() {
35-
arr = [Int] (repeating: 0, count: 20_000)
34+
arr = [Int] (repeating: 0, count: 100_000)
3635
}
3736

3837
func runLoop(_ N: Int) {

branches/swift-5.1-old-llvm-branch/benchmark/single-source/DictionaryOfAnyHashableStrings.swift

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,18 @@ public var DictionaryOfAnyHashableStrings = [
2121
name: "DictionaryOfAnyHashableStrings_insert",
2222
runFunction: run_DictionaryOfAnyHashableStrings_insert,
2323
tags: [.abstraction, .runtime, .cpubench],
24-
setUpFunction: { keys = buildKeys(50) },
25-
legacyFactor: 14
24+
setUpFunction: {
25+
keys = buildKeys(500)
26+
}
2627
),
2728
BenchmarkInfo(
2829
name: "DictionaryOfAnyHashableStrings_lookup",
2930
runFunction: run_DictionaryOfAnyHashableStrings_lookup,
3031
tags: [.abstraction, .runtime, .cpubench],
31-
setUpFunction: { keys = buildKeys(50); workload = buildWorkload() },
32-
legacyFactor: 24
32+
setUpFunction: {
33+
keys = buildKeys(500)
34+
workload = buildWorkload()
35+
}
3336
),
3437
]
3538

@@ -62,7 +65,7 @@ func buildWorkload() -> [AnyHashable: Any] {
6265
@inline(never)
6366
public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) {
6467
precondition(keys.count > 0)
65-
for _ in 1...n {
68+
for _ in 0 ... n {
6669
blackHole(buildWorkload())
6770
}
6871
}
@@ -71,7 +74,7 @@ public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) {
7174
public func run_DictionaryOfAnyHashableStrings_lookup(_ n: Int) {
7275
precondition(workload.count > 0)
7376
precondition(keys.count > 0)
74-
for _ in 1...n {
77+
for _ in 0 ... n {
7578
for i in 0 ..< keys.count {
7679
let key = keys[i]
7780
CheckResults((workload[key] as! Int) == i)

branches/swift-5.1-old-llvm-branch/benchmark/single-source/Substring.swift

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public let SubstringTest = [
3131

3232
// A string that doesn't fit in small string storage and doesn't fit in Latin-1
3333
let longWide = "fὢasὢodὢijὢadὢolὢsjὢalὢsdὢjlὢasὢdfὢijὢliὢsdὢjøὢslὢdiὢalὢiὢ"
34-
let (s1, ss1) = equivalentWithDistinctBuffers()
35-
let (s2, ss2) = equivalentWithDistinctBuffers()
3634

3735
@inline(never)
3836
public func run_SubstringFromLongString(_ N: Int) {
@@ -91,33 +89,33 @@ private func equivalentWithDistinctBuffers() -> (String, Substring) {
9189

9290
@inline(never)
9391
public func run_EqualStringSubstring(_ N: Int) {
94-
let (a, b) = (s1, ss1)
92+
let (a, b) = equivalentWithDistinctBuffers()
9593
for _ in 1...N*500 {
9694
blackHole(a == b)
9795
}
9896
}
9997

10098
@inline(never)
10199
public func run_EqualSubstringString(_ N: Int) {
102-
let (a, b) = (s1, ss1)
100+
let (a, b) = equivalentWithDistinctBuffers()
103101
for _ in 1...N*500 {
104102
blackHole(b == a)
105103
}
106104
}
107105

108106
@inline(never)
109107
public func run_EqualSubstringSubstring(_ N: Int) {
110-
let (_, a) = (s1, ss1)
111-
let (_, b) = (s2, ss2)
108+
let (_, a) = equivalentWithDistinctBuffers()
109+
let (_, b) = equivalentWithDistinctBuffers()
112110
for _ in 1...N*500 {
113111
blackHole(a == b)
114112
}
115113
}
116114

117115
@inline(never)
118116
public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
119-
let (_, a) = (s1, ss1)
120-
let (_, b) = (s2, ss2)
117+
let (_, a) = equivalentWithDistinctBuffers()
118+
let (_, b) = equivalentWithDistinctBuffers()
121119
func check<T>(_ x: T, _ y: T) where T : Equatable {
122120
blackHole(x == y)
123121
}
@@ -134,24 +132,24 @@ where T : StringProtocol, U : StringProtocol {
134132

135133
@inline(never)
136134
public func run _EqualStringSubstringGenericStringProtocol(_ N: Int) {
137-
let (a, b) = (s1, ss1)
135+
let (a, b) = equivalentWithDistinctBuffers()
138136
for _ in 1...N*500 {
139137
checkEqual(a, b)
140138
}
141139
}
142140

143141
@inline(never)
144142
public func run _EqualSubstringStringGenericStringProtocol(_ N: Int) {
145-
let (a, b) = (s1, ss1)
143+
let (a, b) = equivalentWithDistinctBuffers()
146144
for _ in 1...N*500 {
147145
checkEqual(b, a)
148146
}
149147
}
150148

151149
@inline(never)
152150
public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
153-
let (_, a) = (s1, ss1)
154-
let (_, b) = (s2, ss2)
151+
let (_, a) = equivalentWithDistinctBuffers()
152+
let (_, b) = equivalentWithDistinctBuffers()
155153
for _ in 1...N*500 {
156154
checkEqual(a, b)
157155
}
@@ -163,15 +161,15 @@ public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
163161
/*
164162
@inline(never)
165163
public func run _LessStringSubstring(_ N: Int) {
166-
let (a, b) = (s1, ss1)
164+
let (a, b) = equivalentWithDistinctBuffers()
167165
for _ in 1...N*500 {
168166
blackHole(a < b)
169167
}
170168
}
171169

172170
@inline(never)
173171
public func run _LessSubstringString(_ N: Int) {
174-
let (a, b) = (s1, ss1)
172+
let (a, b) = equivalentWithDistinctBuffers()
175173
for _ in 1...N*500 {
176174
blackHole(b < a)
177175
}
@@ -180,17 +178,17 @@ public func run _LessSubstringString(_ N: Int) {
180178

181179
@inline(never)
182180
public func run_LessSubstringSubstring(_ N: Int) {
183-
let (_, a) = (s1, ss1)
184-
let (_, b) = (s2, ss2)
181+
let (_, a) = equivalentWithDistinctBuffers()
182+
let (_, b) = equivalentWithDistinctBuffers()
185183
for _ in 1...N*500 {
186184
blackHole(a < b)
187185
}
188186
}
189187

190188
@inline(never)
191189
public func run_LessSubstringSubstringGenericComparable(_ N: Int) {
192-
let (_, a) = (s1, ss1)
193-
let (_, b) = (s2, ss2)
190+
let (_, a) = equivalentWithDistinctBuffers()
191+
let (_, b) = equivalentWithDistinctBuffers()
194192
func check<T>(_ x: T, _ y: T) where T : Comparable {
195193
blackHole(x < y)
196194
}
@@ -253,24 +251,24 @@ where T : StringProtocol, U : StringProtocol {
253251

254252
@inline(never)
255253
public func run _LessStringSubstringGenericStringProtocol(_ N: Int) {
256-
let (a, b) = (s1, ss1)
254+
let (a, b) = equivalentWithDistinctBuffers()
257255
for _ in 1...N*500 {
258256
checkLess(a, b)
259257
}
260258
}
261259

262260
@inline(never)
263261
public func run _LessSubstringStringGenericStringProtocol(_ N: Int) {
264-
let (a, b) = (s1, ss1)
262+
let (a, b) = equivalentWithDistinctBuffers()
265263
for _ in 1...N*500 {
266264
checkLess(b, a)
267265
}
268266
}
269267

270268
@inline(never)
271269
public func run _LessSubstringSubstringGenericStringProtocol(_ N: Int) {
272-
let (_, a) = (s1, ss1)
273-
let (_, b) = (s2, ss2)
270+
let (_, a) = equivalentWithDistinctBuffers()
271+
let (_, b) = equivalentWithDistinctBuffers()
274272
for _ in 1...N*500 {
275273
checkLess(a, b)
276274
}

branches/swift-5.1-old-llvm-branch/include/swift/AST/Expr.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -823,11 +823,11 @@ class NumberLiteralExpr : public LiteralExpr {
823823
}
824824
};
825825

826-
827826
/// Integer literal with a '+' or '-' sign, like '+4' or '- 2'.
828827
///
829-
/// After semantic analysis assigns types, this is guaranteed to only have
830-
/// a BuiltinIntegerType.
828+
/// After semantic analysis assigns types, this is guaranteed to have
829+
/// a BuiltinIntegerType or be a normal type and implicitly be
830+
/// AnyBuiltinIntegerType.
831831
class IntegerLiteralExpr : public NumberLiteralExpr {
832832
public:
833833
IntegerLiteralExpr(StringRef Val, SourceLoc DigitsLoc, bool Implicit = false)
@@ -855,9 +855,12 @@ class IntegerLiteralExpr : public NumberLiteralExpr {
855855
};
856856

857857
/// FloatLiteralExpr - Floating point literal, like '4.0'. After semantic
858-
/// analysis assigns types, this is guaranteed to only have a
858+
/// analysis assigns types, BuiltinTy is guaranteed to only have a
859859
/// BuiltinFloatingPointType.
860860
class FloatLiteralExpr : public NumberLiteralExpr {
861+
/// This is the type of the builtin literal.
862+
Type BuiltinTy;
863+
861864
public:
862865
FloatLiteralExpr(StringRef Val, SourceLoc Loc, bool Implicit = false)
863866
: NumberLiteralExpr(ExprKind::FloatLiteral, Val, Loc, Implicit)
@@ -870,6 +873,9 @@ class FloatLiteralExpr : public NumberLiteralExpr {
870873
static bool classof(const Expr *E) {
871874
return E->getKind() == ExprKind::FloatLiteral;
872875
}
876+
877+
Type getBuiltinType() const { return BuiltinTy; }
878+
void setBuiltinType(Type ty) { BuiltinTy = ty; }
873879
};
874880

875881
/// A Boolean literal ('true' or 'false')

branches/swift-5.1-old-llvm-branch/include/swift/SIL/OptimizationRemark.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ struct Argument {
5050
Argument(StringRef Key, unsigned long long N);
5151

5252
Argument(StringRef Key, SILFunction *F);
53-
Argument(StringRef Key, SILType Ty);
54-
Argument(StringRef Key, CanType Ty);
53+
Argument(StringRef Key, SILType *Ty);
5554
};
5655

5756
/// Shorthand to insert named-value pairs.

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILBuilder.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -918,10 +918,8 @@ class SILBuilder {
918918
} \
919919
Copy##Name##ValueInst *createCopy##Name##Value(SILLocation Loc, \
920920
SILValue operand) { \
921-
auto type = getFunction().getLoweredType( \
922-
operand->getType().getASTType().getReferenceStorageReferent()); \
923921
return insert(new (getModule()) \
924-
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, type)); \
922+
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, getModule())); \
925923
}
926924
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
927925
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...") \

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILFunction.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,6 @@ class SILModule;
3838
class SILFunctionBuilder;
3939
class SILProfiler;
4040

41-
namespace Lowering {
42-
class TypeLowering;
43-
class AbstractionPattern;
44-
}
45-
4641
enum IsBare_t { IsNotBare, IsBare };
4742
enum IsTransparent_t { IsNotTransparent, IsTransparent };
4843
enum Inline_t { InlineDefault, NoInline, AlwaysInline };
@@ -469,19 +464,6 @@ class SILFunction
469464
: ResilienceExpansion::Maximal);
470465
}
471466

472-
const Lowering::TypeLowering &
473-
getTypeLowering(Lowering::AbstractionPattern orig, Type subst);
474-
475-
const Lowering::TypeLowering &getTypeLowering(Type t) const;
476-
477-
SILType getLoweredType(Lowering::AbstractionPattern orig, Type subst) const;
478-
479-
SILType getLoweredType(Type t) const;
480-
481-
SILType getLoweredLoadableType(Type t) const;
482-
483-
const Lowering::TypeLowering &getTypeLowering(SILType type) const;
484-
485467
/// Returns true if this function has a calling convention that has a self
486468
/// argument.
487469
bool hasSelfParam() const {

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILInstruction.h

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,26 +3929,30 @@ class StoreReferenceInstBase : public InstructionBase<K, NonValueInstruction> {
39293929
/// \param loc The location of the expression that caused the load.
39303930
/// \param lvalue The SILValue representing the address to
39313931
/// use for the load.
3932-
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3932+
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
39333933
class Load##Name##Inst \
39343934
: public LoadReferenceInstBase<SILInstructionKind::Load##Name##Inst> { \
39353935
friend SILBuilder; \
39363936
Load##Name##Inst(SILDebugLocation loc, SILValue lvalue, IsTake_t isTake) \
39373937
: LoadReferenceInstBase(loc, lvalue, isTake) {} \
39383938
};
3939+
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3940+
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...")
39393941
#include "swift/AST/ReferenceStorage.def"
39403942

39413943
/// Represents a store to a dynamic reference storage memory location.
39423944
/// This is only required for address-only scenarios; for loadable
39433945
/// references, it's better to use a ref_to_##name and a store.
3944-
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3946+
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
39453947
class Store##Name##Inst \
39463948
: public StoreReferenceInstBase<SILInstructionKind::Store##Name##Inst> { \
39473949
friend SILBuilder; \
39483950
Store##Name##Inst(SILDebugLocation loc, SILValue src, SILValue dest, \
39493951
IsInitialization_t isInit) \
39503952
: StoreReferenceInstBase(loc, src, dest, isInit) {} \
39513953
};
3954+
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3955+
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...")
39523956
#include "swift/AST/ReferenceStorage.def"
39533957

39543958
/// CopyAddrInst - Represents a copy from one memory location to another. This
@@ -6328,8 +6332,9 @@ class Copy##Name##ValueInst \
63286332
SingleValueInstruction> { \
63296333
friend class SILBuilder; \
63306334
Copy##Name##ValueInst(SILDebugLocation DebugLoc, SILValue operand, \
6331-
SILType type) \
6332-
: UnaryInstructionBase(DebugLoc, operand, type) {} \
6335+
SILModule &M) \
6336+
: UnaryInstructionBase(DebugLoc, operand, \
6337+
operand->getType().getReferentType(M)) {} \
63336338
};
63346339
#include "swift/AST/ReferenceStorage.def"
63356340

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILModule.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,7 @@ class SILModule {
598598

599599
/// Can value operations (copies and destroys) on the given lowered type
600600
/// be performed in this module?
601-
// FIXME: Expansion
602-
bool isTypeABIAccessible(SILType type,
603-
ResilienceExpansion forExpansion
604-
= ResilienceExpansion::Minimal);
601+
bool isTypeABIAccessible(SILType type);
605602

606603
/// Can type metadata for the given formal type be fetched in
607604
/// the given module?

branches/swift-5.1-old-llvm-branch/include/swift/SIL/SILType.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -477,6 +477,12 @@ class SILType {
477477
/// representation. Class existentials do not always qualify.
478478
bool isHeapObjectReferenceType() const;
479479

480+
/// Return the SILType corresponding to the underlying type of the given
481+
/// metatype type.
482+
///
483+
/// *NOTE* Only call on SILTypes for metatype types.
484+
SILType getMetatypeInstanceType(SILModule& M) const;
485+
480486
/// Returns true if this SILType is an aggregate that contains \p Ty
481487
bool aggregateContainsRecord(SILType Ty, SILModule &SILMod) const;
482488

@@ -495,6 +501,10 @@ class SILType {
495501

496502
/// Returns true if this is the AnyObject SILType;
497503
bool isAnyObject() const { return getASTType()->isAnyObject(); }
504+
505+
/// Returns the underlying referent SILType of an @sil_unowned or @sil_weak
506+
/// Type.
507+
SILType getReferentType(SILModule &M) const;
498508

499509
/// Returns a SILType with any archetypes mapped out of context.
500510
SILType mapTypeOutOfContext() const;

0 commit comments

Comments
 (0)