Skip to content

Commit e4902cf

Browse files
authored
---
yaml --- r: 278527 b: refs/heads/swift-5.1-old-llvm-branch c: 2813912 h: refs/heads/master i: 278525: c7b7f64 278523: 415d636 278519: f854f03 278511: be1dd0d 278495: 0680f71 278463: 92fe4de 278399: bd65bc3 278271: 79473d5 278015: 44b7e58 277503: c468e33 276479: 34835d6 274431: dece103 270335: 4428302 262143: ddec100
1 parent 91e67ff commit e4902cf

File tree

72 files changed

+800
-522
lines changed

Some content is hidden

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

72 files changed

+800
-522
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: 5160da6a2e0f4c279f883dbf56ce8baf56fba30e
1244+
refs/heads/swift-5.1-old-llvm-branch: 2813912c486c80b4f5bc78f62b77dc3459945aad
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: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ public let ArrayInClass = [
1717
runFunction: run_ArrayInClass,
1818
tags: [.validation, .api, .Array],
1919
setUpFunction: { ac = ArrayContainer() },
20-
tearDownFunction: { ac = nil }),
20+
tearDownFunction: { ac = nil },
21+
legacyFactor: 5),
2122
BenchmarkInfo(name: "DistinctClassFieldAccesses",
2223
runFunction: run_DistinctClassFieldAccesses,
23-
tags: [.unstable, .api, .Array],
24-
setUpFunction: { workload = ClassWithArrs(N: 100_000) },
24+
tags: [.validation, .api, .Array],
25+
setUpFunction: { workload = ClassWithArrs(N: 10_000) },
2526
tearDownFunction: { workload = nil }),
2627
]
2728

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

3334
init() {
34-
arr = [Int] (repeating: 0, count: 100_000)
35+
arr = [Int] (repeating: 0, count: 20_000)
3536
}
3637

3738
func runLoop(_ N: Int) {

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

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

@@ -65,7 +62,7 @@ func buildWorkload() -> [AnyHashable: Any] {
6562
@inline(never)
6663
public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) {
6764
precondition(keys.count > 0)
68-
for _ in 0 ... n {
65+
for _ in 1...n {
6966
blackHole(buildWorkload())
7067
}
7168
}
@@ -74,7 +71,7 @@ public func run_DictionaryOfAnyHashableStrings_insert(_ n: Int) {
7471
public func run_DictionaryOfAnyHashableStrings_lookup(_ n: Int) {
7572
precondition(workload.count > 0)
7673
precondition(keys.count > 0)
77-
for _ in 0 ... n {
74+
for _ in 1...n {
7875
for i in 0 ..< keys.count {
7976
let key = keys[i]
8077
CheckResults((workload[key] as! Int) == i)

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

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ 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()
3436

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

9092
@inline(never)
9193
public func run_EqualStringSubstring(_ N: Int) {
92-
let (a, b) = equivalentWithDistinctBuffers()
94+
let (a, b) = (s1, ss1)
9395
for _ in 1...N*500 {
9496
blackHole(a == b)
9597
}
9698
}
9799

98100
@inline(never)
99101
public func run_EqualSubstringString(_ N: Int) {
100-
let (a, b) = equivalentWithDistinctBuffers()
102+
let (a, b) = (s1, ss1)
101103
for _ in 1...N*500 {
102104
blackHole(b == a)
103105
}
104106
}
105107

106108
@inline(never)
107109
public func run_EqualSubstringSubstring(_ N: Int) {
108-
let (_, a) = equivalentWithDistinctBuffers()
109-
let (_, b) = equivalentWithDistinctBuffers()
110+
let (_, a) = (s1, ss1)
111+
let (_, b) = (s2, ss2)
110112
for _ in 1...N*500 {
111113
blackHole(a == b)
112114
}
113115
}
114116

115117
@inline(never)
116118
public func run_EqualSubstringSubstringGenericEquatable(_ N: Int) {
117-
let (_, a) = equivalentWithDistinctBuffers()
118-
let (_, b) = equivalentWithDistinctBuffers()
119+
let (_, a) = (s1, ss1)
120+
let (_, b) = (s2, ss2)
119121
func check<T>(_ x: T, _ y: T) where T : Equatable {
120122
blackHole(x == y)
121123
}
@@ -132,24 +134,24 @@ where T : StringProtocol, U : StringProtocol {
132134

133135
@inline(never)
134136
public func run _EqualStringSubstringGenericStringProtocol(_ N: Int) {
135-
let (a, b) = equivalentWithDistinctBuffers()
137+
let (a, b) = (s1, ss1)
136138
for _ in 1...N*500 {
137139
checkEqual(a, b)
138140
}
139141
}
140142

141143
@inline(never)
142144
public func run _EqualSubstringStringGenericStringProtocol(_ N: Int) {
143-
let (a, b) = equivalentWithDistinctBuffers()
145+
let (a, b) = (s1, ss1)
144146
for _ in 1...N*500 {
145147
checkEqual(b, a)
146148
}
147149
}
148150

149151
@inline(never)
150152
public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
151-
let (_, a) = equivalentWithDistinctBuffers()
152-
let (_, b) = equivalentWithDistinctBuffers()
153+
let (_, a) = (s1, ss1)
154+
let (_, b) = (s2, ss2)
153155
for _ in 1...N*500 {
154156
checkEqual(a, b)
155157
}
@@ -161,15 +163,15 @@ public func run _EqualSubstringSubstringGenericStringProtocol(_ N: Int) {
161163
/*
162164
@inline(never)
163165
public func run _LessStringSubstring(_ N: Int) {
164-
let (a, b) = equivalentWithDistinctBuffers()
166+
let (a, b) = (s1, ss1)
165167
for _ in 1...N*500 {
166168
blackHole(a < b)
167169
}
168170
}
169171

170172
@inline(never)
171173
public func run _LessSubstringString(_ N: Int) {
172-
let (a, b) = equivalentWithDistinctBuffers()
174+
let (a, b) = (s1, ss1)
173175
for _ in 1...N*500 {
174176
blackHole(b < a)
175177
}
@@ -178,17 +180,17 @@ public func run _LessSubstringString(_ N: Int) {
178180

179181
@inline(never)
180182
public func run_LessSubstringSubstring(_ N: Int) {
181-
let (_, a) = equivalentWithDistinctBuffers()
182-
let (_, b) = equivalentWithDistinctBuffers()
183+
let (_, a) = (s1, ss1)
184+
let (_, b) = (s2, ss2)
183185
for _ in 1...N*500 {
184186
blackHole(a < b)
185187
}
186188
}
187189

188190
@inline(never)
189191
public func run_LessSubstringSubstringGenericComparable(_ N: Int) {
190-
let (_, a) = equivalentWithDistinctBuffers()
191-
let (_, b) = equivalentWithDistinctBuffers()
192+
let (_, a) = (s1, ss1)
193+
let (_, b) = (s2, ss2)
192194
func check<T>(_ x: T, _ y: T) where T : Comparable {
193195
blackHole(x < y)
194196
}
@@ -251,24 +253,24 @@ where T : StringProtocol, U : StringProtocol {
251253

252254
@inline(never)
253255
public func run _LessStringSubstringGenericStringProtocol(_ N: Int) {
254-
let (a, b) = equivalentWithDistinctBuffers()
256+
let (a, b) = (s1, ss1)
255257
for _ in 1...N*500 {
256258
checkLess(a, b)
257259
}
258260
}
259261

260262
@inline(never)
261263
public func run _LessSubstringStringGenericStringProtocol(_ N: Int) {
262-
let (a, b) = equivalentWithDistinctBuffers()
264+
let (a, b) = (s1, ss1)
263265
for _ in 1...N*500 {
264266
checkLess(b, a)
265267
}
266268
}
267269

268270
@inline(never)
269271
public func run _LessSubstringSubstringGenericStringProtocol(_ N: Int) {
270-
let (_, a) = equivalentWithDistinctBuffers()
271-
let (_, b) = equivalentWithDistinctBuffers()
272+
let (_, a) = (s1, ss1)
273+
let (_, b) = (s2, ss2)
272274
for _ in 1...N*500 {
273275
checkLess(a, b)
274276
}

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

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

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

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

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,8 +918,10 @@ 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()); \
921923
return insert(new (getModule()) \
922-
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, getModule())); \
924+
Copy##Name##ValueInst(getSILDebugLocation(Loc), operand, type)); \
923925
}
924926
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
925927
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...") \

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

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

41+
namespace Lowering {
42+
class TypeLowering;
43+
class AbstractionPattern;
44+
}
45+
4146
enum IsBare_t { IsNotBare, IsBare };
4247
enum IsTransparent_t { IsNotTransparent, IsTransparent };
4348
enum Inline_t { InlineDefault, NoInline, AlwaysInline };
@@ -464,6 +469,19 @@ class SILFunction
464469
: ResilienceExpansion::Maximal);
465470
}
466471

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+
467485
/// Returns true if this function has a calling convention that has a self
468486
/// argument.
469487
bool hasSelfParam() const {

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

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3929,30 +3929,26 @@ 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_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3932+
#define NEVER_OR_SOMETIMES_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, "...")
39413939
#include "swift/AST/ReferenceStorage.def"
39423940

39433941
/// Represents a store to a dynamic reference storage memory location.
39443942
/// This is only required for address-only scenarios; for loadable
39453943
/// references, it's better to use a ref_to_##name and a store.
3946-
#define NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3944+
#define NEVER_OR_SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
39473945
class Store##Name##Inst \
39483946
: public StoreReferenceInstBase<SILInstructionKind::Store##Name##Inst> { \
39493947
friend SILBuilder; \
39503948
Store##Name##Inst(SILDebugLocation loc, SILValue src, SILValue dest, \
39513949
IsInitialization_t isInit) \
39523950
: StoreReferenceInstBase(loc, src, dest, isInit) {} \
39533951
};
3954-
#define SOMETIMES_LOADABLE_CHECKED_REF_STORAGE(Name, ...) \
3955-
NEVER_LOADABLE_CHECKED_REF_STORAGE(Name, "...")
39563952
#include "swift/AST/ReferenceStorage.def"
39573953

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

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

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

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

603606
/// Can type metadata for the given formal type be fetched in
604607
/// the given module?

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -477,12 +477,6 @@ 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-
486480
/// Returns true if this SILType is an aggregate that contains \p Ty
487481
bool aggregateContainsRecord(SILType Ty, SILModule &SILMod) const;
488482

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

502496
/// Returns true if this is the AnyObject SILType;
503497
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;
508498

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

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -769,13 +769,16 @@ class TypeConverter {
769769
ResilienceExpansion::Minimal);
770770

771771
// Returns the lowered SIL type for a Swift type.
772-
SILType getLoweredType(Type t) {
773-
return getTypeLowering(t, ResilienceExpansion::Minimal).getLoweredType();
772+
SILType getLoweredType(Type t, ResilienceExpansion forExpansion
773+
= ResilienceExpansion::Minimal) {
774+
return getTypeLowering(t, forExpansion).getLoweredType();
774775
}
775776

776777
// Returns the lowered SIL type for a Swift type.
777-
SILType getLoweredType(AbstractionPattern origType, Type substType) {
778-
return getTypeLowering(origType, substType, ResilienceExpansion::Minimal)
778+
SILType getLoweredType(AbstractionPattern origType, Type substType,
779+
ResilienceExpansion forExpansion =
780+
ResilienceExpansion::Minimal) {
781+
return getTypeLowering(origType, substType, forExpansion)
779782
.getLoweredType();
780783
}
781784

0 commit comments

Comments
 (0)