Skip to content

Commit 88a1a86

Browse files
committed
---
yaml --- r: 347129 b: refs/heads/master c: 08b6871 h: refs/heads/master i: 347127: 2b55d6a
1 parent ca63e7c commit 88a1a86

File tree

8 files changed

+27
-6
lines changed

8 files changed

+27
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: ed8c68d4243b59861bbc9776ee5a6ad77a5cc354
2+
refs/heads/master: 08b6871abb38b002d9bcdea07361b1574323b468
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/SILOptimizer/Analysis/ArraySemantic.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ ArrayCallKind swift::ArraySemanticsCall::getKind() const {
168168
llvm::StringSwitch<ArrayCallKind>(Attrs)
169169
.Case("array.props.isNativeTypeChecked",
170170
ArrayCallKind::kArrayPropsIsNativeTypeChecked)
171-
.Case("array.init", ArrayCallKind::kArrayInit)
171+
.StartsWith("array.init", ArrayCallKind::kArrayInit)
172172
.Case("array.uninitialized", ArrayCallKind::kArrayUninitialized)
173173
.Case("array.check_subscript", ArrayCallKind::kCheckSubscript)
174174
.Case("array.check_index", ArrayCallKind::kCheckIndex)

trunk/lib/SILOptimizer/Transforms/ArrayCountPropagation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ bool ArrayAllocation::isInitializationWithKnownCount() {
102102
(ArrayValue = Uninitialized.getArrayValue()))
103103
return true;
104104

105-
ArraySemanticsCall Init(Alloc, "array.init");
105+
ArraySemanticsCall Init(Alloc, "array.init", /*matchPartialName*/true);
106106
if (Init &&
107107
(ArrayCount = Init.getInitializationCount()) &&
108108
(ArrayValue = Init.getArrayValue()))

trunk/lib/SILOptimizer/Utils/ConstantFolding.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -995,11 +995,14 @@ bool isLossyUnderflow(int srcExponent, uint64_t srcSignificand,
995995
: srcSignificand;
996996

997997
// Compute the significand bits lost due to subnormal form. Note that the
998-
// integer part: 1 will use up a significand bit in denormal form.
998+
// integer part: 1 will use up a significand bit in subnormal form.
999999
unsigned additionalLoss = destSem.minExponent - srcExponent + 1;
1000+
// Lost bits cannot exceed Double.minExponent - Double.significandWidth = 53.
1001+
// This can happen when truncating from Float80 to Double.
1002+
assert(additionalLoss <= 53);
10001003

10011004
// Check whether a set LSB is lost due to subnormal representation.
1002-
unsigned lostLSBBitMask = (1 << additionalLoss) - 1;
1005+
uint64_t lostLSBBitMask = ((uint64_t)1 << additionalLoss) - 1;
10031006
return (truncSignificand & lostLSBBitMask);
10041007
}
10051008

trunk/stdlib/public/core/Array.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ extension Array: RangeReplaceableCollection {
802802
/// print(emptyArray.isEmpty)
803803
/// // Prints "true"
804804
@inlinable
805-
@_semantics("array.init")
805+
@_semantics("array.init.empty")
806806
public init() {
807807
_buffer = _Buffer()
808808
}

trunk/stdlib/public/core/ArrayShared.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ public struct _DependenceToken {
2727
/// - Precondition: `storage` is `_ContiguousArrayStorage`.
2828
@inlinable // FIXME(inline-always)
2929
@inline(__always)
30+
@_semantics("array.uninitialized_intrinsic")
3031
public // COMPILER_INTRINSIC
3132
func _allocateUninitializedArray<Element>(_ builtinCount: Builtin.Word)
3233
-> (Array<Element>, Builtin.RawPointer) {

trunk/test/SILOptimizer/diagnostic_constant_propagation_floats.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ func testHexFloatImprecision() {
171171
// Smallest non-zero number representable in Double.
172172
let d2: Double = 0x0.0000000000001p-1022
173173
_blackHole(d2)
174+
let d3: Double = 0x1p-1074
175+
_blackHole(d3)
176+
177+
// Test the case where conversion results in subnormality in the destination.
178+
let d4: Float = 0x1p-149
179+
_blackHole(d4)
180+
let d5: Float = 0x1.8p-149 // expected-warning {{'0x1.8p-149' loses precision during conversion to 'Float}}
181+
_blackHole(d5)
174182

175183
// All warnings are disabled during explict conversions.
176184
_blackHole(Float(0x1.000002p-126))

trunk/test/SILOptimizer/diagnostic_constant_propagation_floats_x86.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,20 @@ func testFloatConvertUnderflow() {
6767
let d4: Double = 5E-324 // expected-warning {{'5E-324' underflows and loses precision during conversion to 'Double'}}
6868
_blackHole(d4)
6969

70+
let e4: Float80 = 0x1p-16445
71+
_blackHole(e4)
72+
7073
// FIXME: if a number is so tiny that it underflows even Float80,
7174
// nothing is reported
7275
let e1: Float80 = 0x1p-16446
7376
_blackHole(e1)
7477

78+
// Test the case where conversion results in subnormality in the destination.
79+
let e2: Double = 0x1p-1074
80+
_blackHole(e2)
81+
let e3: Double = 0x11p-1074 // expected-warning {{'0x11p-1074' underflows and loses precision during conversion to 'Double'}}
82+
_blackHole(e3)
83+
7584
// All warnings are disabled during explict conversions
7685
_blackHole(Float(1E-400))
7786
_blackHole(Double(1E-309))

0 commit comments

Comments
 (0)