Skip to content

Commit 8412047

Browse files
committed
---
yaml --- r: 349116 b: refs/heads/master c: d6fe1e9 h: refs/heads/master
1 parent 0b1b2ee commit 8412047

File tree

21 files changed

+31
-429
lines changed

21 files changed

+31
-429
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: ca19a9d12fe3e819cdc1c61f008f3a07daae0008
2+
refs/heads/master: d6fe1e9d39c99fb5dfc5411ab5c7e82344ecc180
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/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -377,10 +377,6 @@ option(SWIFT_ENABLE_STDLIBCORE_EXCLUSIVITY_CHECKING
377377
"Build stdlibCore with exclusivity checking enabled"
378378
FALSE)
379379

380-
option(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING
381-
"Enable experimental Swift differentiable programming features"
382-
FALSE)
383-
384380
#
385381
# End of user-configurable options.
386382
#

trunk/benchmark/single-source/UTF8Decode.swift

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,6 @@ public let UTF8Decode = [
4242
name: "UTF8Decode_InitFromBytes_ascii",
4343
runFunction: run_UTF8Decode_InitFromBytes_ascii,
4444
tags: [.validation, .api, .String]),
45-
BenchmarkInfo(
46-
name: "UTF8Decode_InitFromData_ascii_as_ascii",
47-
runFunction: run_UTF8Decode_InitFromData_ascii_as_ascii,
48-
tags: [.validation, .api, .String]),
49-
BenchmarkInfo(
50-
name: "UTF8Decode_InitDecoding_ascii_as_ascii",
51-
runFunction: run_UTF8Decode_InitDecoding_ascii_as_ascii,
52-
tags: [.validation, .api, .String]),
53-
BenchmarkInfo(
54-
name: "UTF8Decode_InitFromBytes_ascii_as_ascii",
55-
runFunction: run_UTF8Decode_InitFromBytes_ascii_as_ascii,
56-
tags: [.validation, .api, .String]),
5745
]
5846

5947
// 1-byte sequences
@@ -141,26 +129,4 @@ public func run_UTF8Decode_InitFromBytes_ascii(_ N: Int) {
141129
}
142130
}
143131

144-
@inline(never)
145-
public func run_UTF8Decode_InitFromData_ascii_as_ascii(_ N: Int) {
146-
let input = asciiData
147-
for _ in 0..<1_000*N {
148-
blackHole(String(data: input, encoding: .ascii))
149-
}
150-
}
151-
@inline(never)
152-
public func run_UTF8Decode_InitDecoding_ascii_as_ascii(_ N: Int) {
153-
let input = asciiBytes
154-
for _ in 0..<1_000*N {
155-
blackHole(String(decoding: input, as: Unicode.ASCII.self))
156-
}
157-
}
158-
@inline(never)
159-
public func run_UTF8Decode_InitFromBytes_ascii_as_ascii(_ N: Int) {
160-
let input = asciiBytes
161-
for _ in 0..<1_000*N {
162-
blackHole(String(bytes: input, encoding: .ascii))
163-
}
164-
}
165-
166132

trunk/cmake/modules/AddSwift.cmake

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -422,10 +422,6 @@ function(_add_variant_swift_compile_flags
422422
list(APPEND result "-D" "SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS")
423423
endif()
424424

425-
if(SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING)
426-
list(APPEND result "-D" "SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING")
427-
endif()
428-
429425
set("${result_var_name}" "${result}" PARENT_SCOPE)
430426
endfunction()
431427

trunk/include/swift/SIL/SILConstants.h

Lines changed: 1 addition & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ struct DerivedAddressValue;
3333
struct EnumWithPayloadSymbolicValue;
3434
struct SymbolicValueMemoryObject;
3535
struct UnknownSymbolicValue;
36-
struct SymbolicClosure;
3736

3837
extern llvm::cl::opt<unsigned> ConstExprLimit;
3938

@@ -262,9 +261,6 @@ class SymbolicValue {
262261

263262
/// This represents an array.
264263
RK_Array,
265-
266-
/// This represents a closure.
267-
RK_Closure,
268264
};
269265

270266
union {
@@ -309,7 +305,7 @@ class SymbolicValue {
309305
/// information about the memory object and access path of the access.
310306
DerivedAddressValue *derivedAddress;
311307

312-
// The following two fields are for representing an Array.
308+
// The following fields are for representing an Array.
313309
//
314310
// In Swift, an array is a non-trivial struct that stores a reference to an
315311
// internal storage: _ContiguousArrayStorage. Though arrays have value
@@ -333,10 +329,6 @@ class SymbolicValue {
333329
/// When this symbolic value is of an "Array" kind, this stores a memory
334330
/// object that contains a SymbolicArrayStorage value.
335331
SymbolicValueMemoryObject *array;
336-
337-
/// When this symbolic value is of "Closure" kind, store a pointer to the
338-
/// symbolic representation of the closure.
339-
SymbolicClosure *closure;
340332
} value;
341333

342334
RepresentationKind representationKind : 8;
@@ -392,9 +384,6 @@ class SymbolicValue {
392384
/// This represents an array value.
393385
Array,
394386

395-
/// This represents a closure.
396-
Closure,
397-
398387
/// These values are generally only seen internally to the system, external
399388
/// clients shouldn't have to deal with them.
400389
UninitMemory
@@ -544,22 +533,6 @@ class SymbolicValue {
544533
/// Return the type of this array symbolic value.
545534
Type getArrayType() const;
546535

547-
/// Create and return a symbolic value that represents a closure.
548-
/// \param target SILFunction corresponding the target of the closure.
549-
/// \param capturedArguments an array consisting of SILValues of captured
550-
/// arguments along with their symbolic values when available.
551-
/// \param allocator the allocator to use for storing the contents of this
552-
/// symbolic value.
553-
static SymbolicValue makeClosure(
554-
SILFunction *target,
555-
ArrayRef<std::pair<SILValue, Optional<SymbolicValue>>> capturedArguments,
556-
SymbolicValueAllocator &allocator);
557-
558-
SymbolicClosure *getClosure() const {
559-
assert(getKind() == Closure);
560-
return value.closure;
561-
}
562-
563536
//===--------------------------------------------------------------------===//
564537
// Helpers
565538

@@ -634,57 +607,6 @@ struct SymbolicValueMemoryObject {
634607
SymbolicValueMemoryObject(const SymbolicValueMemoryObject &) = delete;
635608
void operator=(const SymbolicValueMemoryObject &) = delete;
636609
};
637-
638-
using SymbolicClosureArgument = std::pair<SILValue, Optional<SymbolicValue>>;
639-
640-
/// Representation of a symbolic closure. A symbolic closure consists of a
641-
/// SILFunction and an array of SIL values, corresponding to the captured
642-
/// arguments, and (optional) symbolic values representing the constant values
643-
/// of the captured arguments. The symbolic values are optional as it is not
644-
/// necessary for every captured argument to be a constant, which enables
645-
/// representing closures whose captured arguments are not compile-time
646-
/// constants.
647-
struct SymbolicClosure final
648-
: private llvm::TrailingObjects<SymbolicClosure, SymbolicClosureArgument> {
649-
650-
friend class llvm::TrailingObjects<SymbolicClosure, SymbolicClosureArgument>;
651-
652-
private:
653-
654-
SILFunction *target;
655-
656-
// The number of SIL values captured by the closure.
657-
unsigned numCaptures;
658-
659-
// True iff there exists captured arguments whose constant value is not known.
660-
bool hasNonConstantCaptures = true;
661-
662-
SymbolicClosure() = delete;
663-
SymbolicClosure(const SymbolicClosure &) = delete;
664-
SymbolicClosure(SILFunction *callee, unsigned numArguments,
665-
bool nonConstantCaptures)
666-
: target(callee), numCaptures(numArguments),
667-
hasNonConstantCaptures(nonConstantCaptures) {}
668-
669-
public:
670-
static SymbolicClosure *create(SILFunction *callee,
671-
ArrayRef<SymbolicClosureArgument> args,
672-
SymbolicValueAllocator &allocator);
673-
674-
ArrayRef<SymbolicClosureArgument> getCaptures() const {
675-
return {getTrailingObjects<SymbolicClosureArgument>(), numCaptures};
676-
}
677-
678-
// This is used by the llvm::TrailingObjects base class.
679-
size_t numTrailingObjects(OverloadToken<SymbolicClosureArgument>) const {
680-
return numCaptures;
681-
}
682-
683-
SILFunction *getTarget() {
684-
return target;
685-
}
686-
};
687-
688610
} // end namespace swift
689611

690612
#endif

trunk/lib/IRGen/GenEnum.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1127,10 +1127,12 @@ namespace {
11271127
protected:
11281128
int64_t getDiscriminatorIndex(EnumElementDecl *target) const override {
11291129
// The elements are assigned discriminators ABI-compatible with their
1130-
// raw values from C.
1131-
assert(target->getRawValueExpr()
1132-
&& "c-compatible enum elt has no raw value?!");
1133-
auto intExpr = cast<IntegerLiteralExpr>(target->getRawValueExpr());
1130+
// raw values from C. An invalid raw value is assigned the error index -1.
1131+
auto intExpr =
1132+
dyn_cast_or_null<IntegerLiteralExpr>(target->getRawValueExpr());
1133+
if (!intExpr) {
1134+
return -1;
1135+
}
11341136
auto intType = getDiscriminatorType();
11351137

11361138
APInt intValue =

trunk/lib/SIL/SILConstants.cpp

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,6 @@ void SymbolicValue::print(llvm::raw_ostream &os, unsigned indent) const {
126126
case RK_Array: {
127127
os << getArrayType() << ": \n";
128128
getStorageOfArray().print(os, indent);
129-
return;
130-
}
131-
case RK_Closure: {
132-
SymbolicClosure *clo = getClosure();
133-
SILFunction *target = clo->getTarget();
134-
std::string targetName = target->getName();
135-
os << "closure: target: " << targetName;
136-
ArrayRef<SymbolicClosureArgument> args = clo->getCaptures();
137-
os << " captures [\n";
138-
for (SymbolicClosureArgument closureArg : args) {
139-
os.indent(indent + 2) << closureArg.first << "\n";
140-
}
141-
os.indent(indent) << "] values: [\n";
142-
for (SymbolicClosureArgument closureArg : args) {
143-
Optional<SymbolicValue> value = closureArg.second;
144-
if (!value.hasValue()) {
145-
os.indent(indent + 2) << "nil\n";
146-
continue;
147-
}
148-
value->print(os, indent + 2);
149-
}
150-
os.indent(indent) << "]\n";
151-
return;
152129
}
153130
}
154131
}
@@ -185,8 +162,6 @@ SymbolicValue::Kind SymbolicValue::getKind() const {
185162
return ArrayStorage;
186163
case RK_Array:
187164
return Array;
188-
case RK_Closure:
189-
return Closure;
190165
}
191166
llvm_unreachable("covered switch");
192167
}
@@ -244,11 +219,6 @@ SymbolicValue::cloneInto(SymbolicValueAllocator &allocator) const {
244219
SymbolicValue clonedStorage = getStorageOfArray().cloneInto(allocator);
245220
return getArray(getArrayType(), clonedStorage, allocator);
246221
}
247-
case RK_Closure: {
248-
SymbolicClosure *clo = getClosure();
249-
ArrayRef<SymbolicClosureArgument> closureArgs = clo->getCaptures();
250-
return SymbolicValue::makeClosure(clo->getTarget(), closureArgs, allocator);
251-
}
252222
}
253223
llvm_unreachable("covered switch");
254224
}
@@ -691,44 +661,6 @@ Type SymbolicValue::getArrayType() const {
691661
return value.array->getType();
692662
}
693663

694-
//===----------------------------------------------------------------------===//
695-
// Symbolic Closure
696-
//===----------------------------------------------------------------------===//
697-
698-
SymbolicValue SymbolicValue::makeClosure(SILFunction *target,
699-
ArrayRef<SymbolicClosureArgument> args,
700-
SymbolicValueAllocator &allocator) {
701-
auto clo = SymbolicClosure::create(target, args, allocator);
702-
SymbolicValue result;
703-
result.representationKind = RK_Closure;
704-
result.value.closure = clo;
705-
return result;
706-
}
707-
708-
SymbolicClosure *SymbolicClosure::create(SILFunction *target,
709-
ArrayRef<SymbolicClosureArgument> args,
710-
SymbolicValueAllocator &allocator) {
711-
// Determine whether there are captured arguments without a symbolic value.
712-
bool hasNonConstantCapture = false;
713-
for (SymbolicClosureArgument closureArg : args) {
714-
if (!closureArg.second) {
715-
hasNonConstantCapture = true;
716-
break;
717-
}
718-
}
719-
720-
auto byteSizeOfArgs =
721-
SymbolicClosure::totalSizeToAlloc<SymbolicClosureArgument>(args.size());
722-
auto rawMem = allocator.allocate(byteSizeOfArgs, alignof(SymbolicClosure));
723-
// Placement initialize the object.
724-
auto closure = ::new (rawMem)
725-
SymbolicClosure(target, args.size(), hasNonConstantCapture);
726-
std::uninitialized_copy(
727-
args.begin(), args.end(),
728-
closure->getTrailingObjects<SymbolicClosureArgument>());
729-
return closure;
730-
}
731-
732664
//===----------------------------------------------------------------------===//
733665
// Higher level code
734666
//===----------------------------------------------------------------------===//

trunk/lib/SILOptimizer/Utils/ConstExpr.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1630,36 +1630,6 @@ ConstExprFunctionState::evaluateFlowSensitive(SILInstruction *inst) {
16301630
injectEnumInst->getOperand());
16311631
}
16321632

1633-
if (auto *papply = dyn_cast<PartialApplyInst>(inst)) {
1634-
SILValue calleeOperand = papply->getOperand(0);
1635-
SymbolicValue calleeValue = getConstantValue(calleeOperand);
1636-
if (!calleeValue.isConstant())
1637-
return calleeValue;
1638-
if (calleeValue.getKind() != SymbolicValue::Function) {
1639-
return getUnknown(evaluator, (SILInstruction *)papply,
1640-
UnknownReason::InvalidOperandValue);
1641-
}
1642-
1643-
SILFunction *target = calleeValue.getFunctionValue();
1644-
assert(target != nullptr);
1645-
1646-
// Arguments to this partial-apply instruction are the captures of the
1647-
// closure.
1648-
SmallVector<SymbolicClosureArgument, 4> captures;
1649-
for (SILValue argument : papply->getArguments()) {
1650-
SymbolicValue argumentValue = getConstantValue(argument);
1651-
if (!argumentValue.isConstant()) {
1652-
captures.push_back({ argument, None });
1653-
continue;
1654-
}
1655-
captures.push_back({ argument, argumentValue });
1656-
}
1657-
auto closureVal = SymbolicValue::makeClosure(target, captures,
1658-
evaluator.getAllocator());
1659-
setValue(papply, closureVal);
1660-
return None;
1661-
}
1662-
16631633
// If the instruction produces a result, try computing it, and fail if the
16641634
// computation fails.
16651635
if (auto *singleValueInst = dyn_cast<SingleValueInstruction>(inst)) {
@@ -1964,8 +1934,6 @@ ConstExprStepEvaluator::skipByMakingEffectsNonConstant(
19641934
constKind == SymbolicValue::Aggregate ||
19651935
constKind == SymbolicValue::Enum ||
19661936
constKind == SymbolicValue::EnumWithPayload ||
1967-
constKind == SymbolicValue::Array ||
1968-
constKind == SymbolicValue::Closure ||
19691937
constKind == SymbolicValue::UninitMemory);
19701938

19711939
if (constKind != SymbolicValue::Address) {

trunk/lib/Sema/CSSimplify.cpp

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "swift/AST/ExistentialLayout.h"
2121
#include "swift/AST/GenericEnvironment.h"
2222
#include "swift/AST/GenericSignature.h"
23-
#include "swift/AST/Initializer.h"
2423
#include "swift/AST/ParameterList.h"
2524
#include "swift/AST/PropertyWrappers.h"
2625
#include "swift/AST/ProtocolConformance.h"
@@ -4865,19 +4864,7 @@ performMemberLookup(ConstraintKind constraintKind, DeclName memberName,
48654864
// reasonable choice.
48664865
auto addChoice = [&](OverloadChoice candidate) {
48674866
auto decl = candidate.getDecl();
4868-
4869-
// In a pattern binding initializer, immediately reject all of its bound
4870-
// variables. These would otherwise allow circular references.
4871-
if (auto *PBI = dyn_cast<PatternBindingInitializer>(DC)) {
4872-
if (auto *VD = dyn_cast<VarDecl>(decl)) {
4873-
if (PBI->getBinding() == VD->getParentPatternBinding()) {
4874-
result.addUnviable(candidate,
4875-
MemberLookupResult::UR_InstanceMemberOnType);
4876-
return;
4877-
}
4878-
}
4879-
}
4880-
4867+
48814868
// If the result is invalid, skip it.
48824869
// FIXME(InterfaceTypeRequest): isInvalid() should be based on the interface type.
48834870
(void)decl->getInterfaceType();

0 commit comments

Comments
 (0)