Skip to content

Commit 674788d

Browse files
committed
---
yaml --- r: 311294 b: refs/heads/tensorflow-merge c: da93d3e h: refs/heads/master
1 parent d547a11 commit 674788d

File tree

4 files changed

+24
-4
lines changed

4 files changed

+24
-4
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1379,7 +1379,7 @@ refs/heads/chase-my-tail: 8bb91443a9e81bbfac92a2621a0af887a1da8dbf
13791379
refs/heads/consider-outer-alternatives: 708bac749ec60a22a79e2eefbe734f9488a7370d
13801380
refs/heads/revert-25740-oops-i-linked-it-again: fdd41aeb682fc488572bdc1cf71b2ff6997ba576
13811381
refs/heads/swift-5.1-branch-06-12-2019: e63b7b2d3b93c48232d386099d0ec525d21d8f8d
1382-
refs/heads/tensorflow-merge: 3da28223a7f04660946a1849b3c48c49e5854894
1382+
refs/heads/tensorflow-merge: da93d3e5a7d92853001c6b5674960d5fa93a415b
13831383
refs/heads/update-checkout-sha-info: 5832743c5c2a842976c42a508a4c6dcceefb0aef
13841384
refs/tags/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-12-a: 228f0448d9bb909aacbba4afcb7c600a405d15da
13851385
refs/tags/swift-5.1-DEVELOPMENT-SNAPSHOT-2019-06-14-a: 922861a77b5fc2bf46bc917da70ceb15eef76836

branches/tensorflow-merge/lib/ParseSIL/ParseSIL.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,7 @@ void SILParser::convertRequirements(SILFunction *F,
895895
/// - A metatype (the instance type is parsed) ($Float).
896896
/// - An aggregate ([i32 1, i64 2, f32 3.0]).
897897
/// - Aggregates values represent constant arrays/structs/tuples.
898+
/// - A SIL function reference (@foo : $(Int) -> Int).
898899
/// Returns true on error.
899900
static bool parseSymbolicValue(SymbolicValue &value, SILParser &SP,
900901
SILBuilder &B) {
@@ -1010,6 +1011,15 @@ static bool parseSymbolicValue(SymbolicValue &value, SILParser &SP,
10101011
value = SymbolicValue::getMetatype(metatype);
10111012
return false;
10121013
}
1014+
// Handle SIL function references.
1015+
if (P.Tok.is(tok::at_sign)) {
1016+
SILFunction *func;
1017+
SILLocation funcLoc = RegularLocation(P.getEndOfPreviousLoc());
1018+
if (SP.parseSILFunctionRef(funcLoc, func))
1019+
return true;
1020+
value = SymbolicValue::getFunction(func);
1021+
return false;
1022+
}
10131023
// Handle aggregate literals.
10141024
if (P.Tok.is(tok::l_square)) {
10151025
SourceLoc lSquareLoc = P.consumeToken(tok::l_square);

branches/tensorflow-merge/lib/SIL/SILPrinter.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,15 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
12171217
*this << SILType::getPrimitiveObjectType(metatype.getInstanceType());
12181218
return;
12191219
}
1220+
case SymbolicValue::Function: {
1221+
assert(!v.getFunctionValue().second &&
1222+
"SILFunction SymbolicValues with protocol conformances cannot be "
1223+
"printed");
1224+
auto function = v.getFunctionValue().first;
1225+
*this << "@" << function->getName();
1226+
*this << " : $" << function->getLoweredFunctionType();
1227+
return;
1228+
}
12201229
case SymbolicValue::Aggregate:
12211230
*this << "[";
12221231
interleave(v.getAggregateValue(), [&](SymbolicValue element) {
@@ -1226,7 +1235,6 @@ class SILPrinter : public SILInstructionVisitor<SILPrinter> {
12261235
});
12271236
*this << "]";
12281237
return;
1229-
case SymbolicValue::Function:
12301238
case SymbolicValue::UninitMemory:
12311239
case SymbolicValue::Unknown:
12321240
llvm_unreachable("Unimplemented SymbolicValue case");

branches/tensorflow-merge/test/TensorFlow/graph_op_inst.sil

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ bb0:
1515
%2 = graph_op "tf.Dummy"() {float1: f64 3.14, float2: f32 -3.14} : $Tensor<Float>
1616
%3 = graph_op "tf.Dummy"() {string1: "hello", string2: "world"} : $Tensor<Float>
1717
%4 = graph_op "tf.Dummy"() {metatype1: $Float, metatype2: $Tensor<Float>} : $Tensor<Float>
18-
%5 = graph_op "tf.Dummy"() {array: [[i8 1, i32 -2], [f32 -1.0, $Float]]} : $Tensor<Float>
18+
%5 = graph_op "tf.Dummy"() {function1: @chained_op_test : $@convention(thin) (Tensor<Float>, Tensor<Float>) -> Tensor<Float>} : $Tensor<Float>
19+
%6 = graph_op "tf.Dummy"() {array: [[i8 1, i32 -2], [f32 -1.0, $Float]]} : $Tensor<Float>
1920
return %0 : $Tensor<Float>
2021
}
2122

@@ -26,7 +27,8 @@ bb0:
2627
// CHECK-NEXT: %2 = graph_op "tf.Dummy"() {float1: f64 0x40091EB851EB851F /* 3.1400000000000001 */, float2: f32 0xC048F5C3 /* -3.1400001 */} : $Tensor<Float>
2728
// CHECK-NEXT: %3 = graph_op "tf.Dummy"() {string1: "hello", string2: "world"} : $Tensor<Float>
2829
// CHECK-NEXT: %4 = graph_op "tf.Dummy"() {metatype1: $Float, metatype2: $Tensor<Float>} : $Tensor<Float>
29-
// CHECK-NEXT: %5 = graph_op "tf.Dummy"() {array: {{\[\[}}i8 1, i32 -2], [f32 0xBF800000 /* -1 */, $Float]]} : $Tensor<Float>
30+
// CHECK-NEXT: %5 = graph_op "tf.Dummy"() {function1: @chained_op_test : $@convention(thin) (Tensor<Float>, Tensor<Float>) -> Tensor<Float>} : $Tensor<Float>
31+
// CHECK-NEXT: %6 = graph_op "tf.Dummy"() {array: {{\[\[}}i8 1, i32 -2], [f32 0xBF800000 /* -1 */, $Float]]} : $Tensor<Float>
3032
// CHECK-NEXT: return %0 : $Tensor<Float>
3133
// CHECK-NEXT: }
3234

0 commit comments

Comments
 (0)