Skip to content

Commit 14b4b3d

Browse files
---
yaml --- r: 326591 b: refs/heads/tensorflow c: 90a5ac2 h: refs/heads/master i: 326589: 8f4a2ad 326587: 23b62ad 326583: 623179c 326575: 0b12ec8 326559: 08d38cb 326527: e67cc5e
1 parent 78cf838 commit 14b4b3d

Some content is hidden

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

42 files changed

+8681
-6872
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: eb740be819735d6ccdc3d76e3f32f3fc1d4ed6f9
819+
refs/heads/tensorflow: 90a5ac265d2ea3b98f013693e44c4686a23db220
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/include/swift/Basic/Statistics.def

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ FRONTEND_STATISTIC(Sema, NumLeafScopes)
166166
/// This is a measure of complexity of the contraction algorithm.
167167
FRONTEND_STATISTIC(Sema, NumConstraintsConsideredForEdgeContraction)
168168

169+
/// Number of constraint-solving scopes created in the typechecker, while
170+
/// solving expression type constraints. A rough proxy for "how much work the
171+
/// expression typechecker did".
172+
FRONTEND_STATISTIC(Sema, NumCyclicOneWayComponentsCollapsed)
173+
169174
/// Number of declarations that were deserialized. A rough proxy for the amount
170175
/// of material loaded from other modules.
171176
FRONTEND_STATISTIC(Sema, NumDeclsDeserialized)

branches/tensorflow/lib/Sema/BuilderTransform.cpp

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class BuilderClosureVisitor
5252
/// Produce a builder call to the given named function with the given arguments.
5353
Expr *buildCallIfWanted(SourceLoc loc,
5454
Identifier fnName, ArrayRef<Expr *> args,
55-
ArrayRef<Identifier> argLabels = {}) {
55+
ArrayRef<Identifier> argLabels,
56+
bool allowOneWay) {
5657
if (!wantExpr)
5758
return nullptr;
5859

@@ -86,7 +87,7 @@ class BuilderClosureVisitor
8687
/*trailing closure*/ nullptr,
8788
/*implicit*/true);
8889

89-
if (ctx.LangOpts.FunctionBuilderOneWayConstraints) {
90+
if (ctx.LangOpts.FunctionBuilderOneWayConstraints && allowOneWay) {
9091
// Form a one-way constraint to prevent backward propagation.
9192
result = new (ctx) OneWayExpr(result);
9293
}
@@ -176,7 +177,9 @@ class BuilderClosureVisitor
176177

177178
// Call Builder.buildBlock(... args ...)
178179
return buildCallIfWanted(braceStmt->getStartLoc(),
179-
ctx.Id_buildBlock, expressions);
180+
ctx.Id_buildBlock, expressions,
181+
/*argLabels=*/{ },
182+
/*allowOneWay=*/true);
180183
}
181184

182185
Expr *visitReturnStmt(ReturnStmt *stmt) {
@@ -201,7 +204,8 @@ class BuilderClosureVisitor
201204
if (!arg)
202205
return nullptr;
203206

204-
return buildCallIfWanted(doStmt->getStartLoc(), ctx.Id_buildDo, arg);
207+
return buildCallIfWanted(doStmt->getStartLoc(), ctx.Id_buildDo, arg,
208+
/*argLabels=*/{ }, /*allowOneWay=*/true);
205209
}
206210

207211
CONTROL_FLOW_STMT(Yield)
@@ -286,7 +290,12 @@ class BuilderClosureVisitor
286290
// so we just need to call `buildIf` now, since we're at the top level.
287291
if (isOptional) {
288292
chainExpr = buildCallIfWanted(ifStmt->getStartLoc(),
289-
ctx.Id_buildIf, chainExpr);
293+
ctx.Id_buildIf, chainExpr,
294+
/*argLabels=*/{ },
295+
/*allowOneWay=*/true);
296+
} else if (ctx.LangOpts.FunctionBuilderOneWayConstraints) {
297+
// Form a one-way constraint to prevent backward propagation.
298+
chainExpr = new (ctx) OneWayExpr(chainExpr);
290299
}
291300

292301
return chainExpr;
@@ -406,7 +415,8 @@ class BuilderClosureVisitor
406415
bool isSecond = (path & 1);
407416
operand = buildCallIfWanted(operand->getStartLoc(),
408417
ctx.Id_buildEither, operand,
409-
{isSecond ? ctx.Id_second : ctx.Id_first});
418+
{isSecond ? ctx.Id_second : ctx.Id_first},
419+
/*allowOneWay=*/false);
410420
}
411421

412422
// Inject into Optional if required. We'll be adding the call to

0 commit comments

Comments
 (0)