Skip to content

Instantly share code, notes, and snippets.

@dan-zheng
Created July 31, 2018 01:54
Show Gist options
  • Save dan-zheng/214db13a1d8500182d6aafd8c8a5e020 to your computer and use it in GitHub Desktop.
Save dan-zheng/214db13a1d8500182d6aafd8c8a5e020 to your computer and use it in GitHub Desktop.
SIL verification failed, graph_op has artificial location
import TensorFlow
func train(iterationCount: Int) {
let images = Tensor<Float>(ones: [1000, 784])
let batchSize = Float(images.shape[0])
print("Begin training for \(iterationCount) iterations.")
for _ in 0...iterationCount {
let bound = Int32(batchSize)/25
for i in 0..<bound {
let _ = Tensor(1)
}
}
}
train(iterationCount: 20)
$ swiftc -Xllvm -tf-dump-intermediates -O artificial-loc.swift
artificial-loc.swift:11:9: warning: immutable value 'i' was never used; consider replacing with '_' or removing it
for i in 0..<bound {
^
_
--- TFDeabstraction Input: $S4main5train14iterationCountySi_tF
// train(iterationCount:)
sil hidden @$S4main5train14iterationCountySi_tF : $@convention(thin) (Int) -> () {
// %0 // users: %114, %108, %71, %1
bb0(%0 : $Int):
debug_value %0 : $Int, let, name "iterationCount", argno 1 // id: %1
%2 = metatype $@thin Tensor<Float>.Type // user: %23
%3 = metatype $@thin TensorShape.Type // user: %21
%4 = integer_literal $Builtin.Word, 2 // user: %6
// function_ref _allocateUninitializedArray<A>(_:)
%5 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %6
%6 = apply %5<Int32>(%4) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %10, %7, %9
%7 = tuple_extract %6 : $(Array<Int32>, Builtin.RawPointer), 0 // users: %21, %8
retain_value %7 : $Array<Int32> // id: %8
%9 = tuple_extract %6 : $(Array<Int32>, Builtin.RawPointer), 1 // user: %11
release_value %6 : $(Array<Int32>, Builtin.RawPointer) // id: %10
%11 = pointer_to_address %9 : $Builtin.RawPointer to [strict] $*Int32 // users: %14, %16
%12 = integer_literal $Builtin.Int32, 1000 // user: %13
%13 = struct $Int32 (%12 : $Builtin.Int32) // user: %14
store %13 to %11 : $*Int32 // id: %14
%15 = integer_literal $Builtin.Word, 1 // user: %16
%16 = index_addr %11 : $*Int32, %15 : $Builtin.Word // user: %19
%17 = integer_literal $Builtin.Int32, 784 // user: %18
%18 = struct $Int32 (%17 : $Builtin.Int32) // user: %19
store %18 to %16 : $*Int32 // id: %19
// function_ref TensorShape.init(arrayLiteral:)
%20 = function_ref @$S10TensorFlow0A5ShapeV12arrayLiteralACs5Int32Vd_tcfC : $@convention(method) (@owned Array<Int32>, @thin TensorShape.Type) -> @owned TensorShape // user: %21
%21 = apply %20(%7, %3) : $@convention(method) (@owned Array<Int32>, @thin TensorShape.Type) -> @owned TensorShape // user: %23
// function_ref Tensor<>.init(ones:)
%22 = function_ref @$S10TensorFlow0A0VAASjRzrlE4onesACyxGAA0A5ShapeV_tcfC : $@convention(method) <τ_0_0 where τ_0_0 : Numeric, τ_0_0 : AccelerableByTensorFlow> (@owned TensorShape, @thin Tensor<τ_0_0>.Type) -> @owned Tensor<τ_0_0> // user: %23
%23 = apply %22<Float>(%21, %2) : $@convention(method) <τ_0_0 where τ_0_0 : Numeric, τ_0_0 : AccelerableByTensorFlow> (@owned TensorShape, @thin Tensor<τ_0_0>.Type) -> @owned Tensor<τ_0_0> // users: %254, %26, %24
debug_value %23 : $Tensor<Float>, let, name "images" // id: %24
// function_ref Tensor.shape.getter
%25 = function_ref @$S10TensorFlow0A0V5shapeAA0A5ShapeVvg : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed Tensor<τ_0_0>) -> @owned TensorShape // user: %26
%26 = apply %25<Float>(%23) : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed Tensor<τ_0_0>) -> @owned TensorShape // users: %31, %30
%27 = integer_literal $Builtin.Int32, 0 // user: %28
%28 = struct $Int32 (%27 : $Builtin.Int32) // user: %30
// function_ref TensorShape.subscript.getter
%29 = function_ref @$S10TensorFlow0A5ShapeVys5Int32VAEcig : $@convention(method) (Int32, @guaranteed TensorShape) -> Int32 // user: %30
%30 = apply %29(%28, %26) : $@convention(method) (Int32, @guaranteed TensorShape) -> Int32 // user: %32
release_value %26 : $TensorShape // id: %31
%32 = struct_extract %30 : $Int32, #Int32._value // user: %33
%33 = builtin "sitofp_Int32_FPIEEE32"(%32 : $Builtin.Int32) : $Builtin.FPIEEE32 // user: %34
%34 = struct $Float (%33 : $Builtin.FPIEEE32) // users: %172, %165, %157, %151, %35
debug_value %34 : $Float, let, name "batchSize" // id: %35
%36 = integer_literal $Builtin.Word, 1 // user: %38
// function_ref _allocateUninitializedArray<A>(_:)
%37 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %38
%38 = apply %37<Any>(%36) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %42, %39, %41
%39 = tuple_extract %38 : $(Array<Any>, Builtin.RawPointer), 0 // users: %102, %99, %40
retain_value %39 : $Array<Any> // id: %40
%41 = tuple_extract %38 : $(Array<Any>, Builtin.RawPointer), 1 // user: %43
release_value %38 : $(Array<Any>, Builtin.RawPointer) // id: %42
%43 = pointer_to_address %41 : $Builtin.RawPointer to [strict] $*Any // user: %44
%44 = init_existential_addr %43 : $*Any, $String // user: %93
%45 = metatype $@thin String.Type // user: %92
%46 = integer_literal $Builtin.Word, 3 // user: %48
// function_ref _allocateUninitializedArray<A>(_:)
%47 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %48
%48 = apply %47<String>(%46) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %52, %49, %51
%49 = tuple_extract %48 : $(Array<String>, Builtin.RawPointer), 0 // users: %92, %50
retain_value %49 : $Array<String> // id: %50
%51 = tuple_extract %48 : $(Array<String>, Builtin.RawPointer), 1 // user: %53
release_value %48 : $(Array<String>, Builtin.RawPointer) // id: %52
%53 = pointer_to_address %51 : $Builtin.RawPointer to [strict] $*String // users: %66, %77, %68
%54 = metatype $@thin String.Type // user: %64
%55 = string_literal utf8 "Begin training for " // user: %60
%56 = integer_literal $Builtin.Word, 19 // user: %60
%57 = integer_literal $Builtin.Int1, -1 // user: %60
%58 = metatype $@thin String.Type // user: %60
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%59 = function_ref @$SSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %60
%60 = apply %59(%55, %56, %57, %58) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %62
%61 = alloc_stack $String // users: %62, %65, %64
store %60 to %61 : $*String // id: %62
// function_ref String.init<A>(stringInterpolationSegment:)
%63 = function_ref @$SSS26stringInterpolationSegmentSSx_tcs23CustomStringConvertibleRzs20TextOutputStreamableRzlufC : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %64
%64 = apply %63<String>(%61, %54) : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %66
dealloc_stack %61 : $*String // id: %65
store %64 to %53 : $*String // id: %66
%67 = integer_literal $Builtin.Word, 1 // user: %68
%68 = index_addr %53 : $*String, %67 : $Builtin.Word // user: %75
%69 = metatype $@thin String.Type // user: %73
%70 = alloc_stack $Int // users: %71, %74, %73
store %0 to %70 : $*Int // id: %71
// function_ref String.init<A>(stringInterpolationSegment:)
%72 = function_ref @$SSS26stringInterpolationSegmentSSx_tcs23CustomStringConvertibleRzlufC : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in τ_0_0, @thin String.Type) -> @owned String // user: %73
%73 = apply %72<Int>(%70, %69) : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in τ_0_0, @thin String.Type) -> @owned String // user: %75
dealloc_stack %70 : $*Int // id: %74
store %73 to %68 : $*String // id: %75
%76 = integer_literal $Builtin.Word, 2 // user: %77
%77 = index_addr %53 : $*String, %76 : $Builtin.Word // user: %90
%78 = metatype $@thin String.Type // user: %88
%79 = string_literal utf8 " iterations." // user: %84
%80 = integer_literal $Builtin.Word, 12 // user: %84
%81 = integer_literal $Builtin.Int1, -1 // user: %84
%82 = metatype $@thin String.Type // user: %84
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%83 = function_ref @$SSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %84
%84 = apply %83(%79, %80, %81, %82) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %86
%85 = alloc_stack $String // users: %86, %89, %88
store %84 to %85 : $*String // id: %86
// function_ref String.init<A>(stringInterpolationSegment:)
%87 = function_ref @$SSS26stringInterpolationSegmentSSx_tcs23CustomStringConvertibleRzs20TextOutputStreamableRzlufC : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %88
%88 = apply %87<String>(%85, %78) : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %90
dealloc_stack %85 : $*String // id: %89
store %88 to %77 : $*String // id: %90
// function_ref String.init(stringInterpolation:)
%91 = function_ref @$SSS19stringInterpolationS2Sd_tcfC : $@convention(method) (@owned Array<String>, @thin String.Type) -> @owned String // user: %92
%92 = apply %91(%49, %45) : $@convention(method) (@owned Array<String>, @thin String.Type) -> @owned String // user: %93
store %92 to %44 : $*String // id: %93
// function_ref default argument 1 of print(_:separator:terminator:)
%94 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String // user: %95
%95 = apply %94() : $@convention(thin) () -> @owned String // users: %101, %99
// function_ref default argument 2 of print(_:separator:terminator:)
%96 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String // user: %97
%97 = apply %96() : $@convention(thin) () -> @owned String // users: %100, %99
// function_ref print(_:separator:terminator:)
%98 = function_ref @$Ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () // user: %99
%99 = apply %98(%39, %95, %97) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> ()
release_value %97 : $String // id: %100
release_value %95 : $String // id: %101
release_value %39 : $Array<Any> // id: %102
%103 = alloc_stack $IndexingIterator<ClosedRange<Int>>, var, name "$generator" // users: %253, %134, %139
%104 = alloc_stack $ClosedRange<Int> // users: %116, %130, %136
%105 = metatype $@thin Int.Type
%106 = integer_literal $Builtin.Int64, 0 // users: %107, %121
%107 = struct $Int (%106 : $Builtin.Int64) // user: %112
%108 = struct_extract %0 : $Int, #Int._value // user: %121
br bb2 // id: %109
bb1: // Preds: bb3
%110 = metatype $@thin ClosedRange<Int>.Type // user: %116
%111 = alloc_stack $Int // users: %112, %118, %116
store %107 to %111 : $*Int // id: %112
%113 = alloc_stack $Int // users: %114, %117, %116
store %0 to %113 : $*Int // id: %114
// function_ref ClosedRange.init(uncheckedBounds:)
%115 = function_ref @$SSN15uncheckedBoundsSNyxGx5lower_x5uppert_tcfC : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin ClosedRange<τ_0_0>.Type) -> @out ClosedRange<τ_0_0> // user: %116
%116 = apply %115<Int>(%104, %111, %113, %110) : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin ClosedRange<τ_0_0>.Type) -> @out ClosedRange<τ_0_0>
dealloc_stack %113 : $*Int // id: %117
dealloc_stack %111 : $*Int // id: %118
br bb4 // id: %119
bb2: // Preds: bb0
br bb3 // id: %120
bb3: // Preds: bb2
%121 = builtin "cmp_slt_Int64"(%108 : $Builtin.Int64, %106 : $Builtin.Int64) : $Builtin.Int1 // user: %123
%122 = integer_literal $Builtin.Int1, -1 // user: %123
%123 = builtin "xor_Int1"(%121 : $Builtin.Int1, %122 : $Builtin.Int1) : $Builtin.Int1 // user: %124
%124 = struct $Bool (%123 : $Builtin.Int1) // user: %125
%125 = struct_extract %124 : $Bool, #Bool._value // user: %127
%126 = integer_literal $Builtin.Int1, -1 // user: %127
%127 = builtin "xor_Int1"(%125 : $Builtin.Int1, %126 : $Builtin.Int1) : $Builtin.Int1 // user: %128
cond_fail %127 : $Builtin.Int1 // id: %128
br bb1 // id: %129
bb4: // Preds: bb1
%130 = load %104 : $*ClosedRange<Int> // user: %132
%131 = alloc_stack $ClosedRange<Int> // users: %132, %135, %134
store %130 to %131 : $*ClosedRange<Int> // id: %132
// function_ref Collection<>.makeIterator()
%133 = function_ref @$SSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0> // user: %134
%134 = apply %133<ClosedRange<Int>>(%103, %131) : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
dealloc_stack %131 : $*ClosedRange<Int> // id: %135
dealloc_stack %104 : $*ClosedRange<Int> // id: %136
br bb5 // id: %137
bb5: // Preds: bb29 bb4
%138 = alloc_stack $Optional<Int> // users: %143, %144, %141
%139 = begin_access [modify] [static] %103 : $*IndexingIterator<ClosedRange<Int>> // users: %142, %141
// function_ref IndexingIterator.next()
%140 = function_ref @$Ss16IndexingIteratorV4next7ElementQzSgyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element> // user: %141
%141 = apply %140<ClosedRange<Int>>(%138, %139) : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element>
end_access %139 : $*IndexingIterator<ClosedRange<Int>> // id: %142
%143 = load %138 : $*Optional<Int> // user: %145
dealloc_stack %138 : $*Optional<Int> // id: %144
switch_enum %143 : $Optional<Int>, case #Optional.some!enumelt.1: bb7, case #Optional.none!enumelt: bb6 // id: %145
bb6: // Preds: bb5
br bb30 // id: %146
bb7(%147 : $Int): // Preds: bb5
br bb15 // id: %148
bb8: // Preds: bb16
br bb13 // id: %149
bb9: // Preds: bb14
br bb11 // id: %150
bb10: // Preds: bb12
%151 = struct_extract %34 : $Float, #Float._value // user: %152
%152 = builtin "fptosi_FPIEEE32_Int32"(%151 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %153
%153 = struct $Int32 (%152 : $Builtin.Int32) // user: %185
br bb17 // id: %154
bb11: // Preds: bb9
br bb12 // id: %155
bb12: // Preds: bb11
%156 = float_literal $Builtin.FPIEEE32, 0x4F000000 // 2.14748365E+9 // user: %158
%157 = struct_extract %34 : $Float, #Float._value // user: %158
%158 = builtin "fcmp_olt_FPIEEE32"(%157 : $Builtin.FPIEEE32, %156 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %160
%159 = integer_literal $Builtin.Int1, -1 // user: %160
%160 = builtin "xor_Int1"(%158 : $Builtin.Int1, %159 : $Builtin.Int1) : $Builtin.Int1 // user: %161
cond_fail %160 : $Builtin.Int1 // id: %161
br bb10 // id: %162
bb13: // Preds: bb8
br bb14 // id: %163
bb14: // Preds: bb13
%164 = float_literal $Builtin.FPIEEE32, 0xCF000001 // -2.1474839E+9 // user: %166
%165 = struct_extract %34 : $Float, #Float._value // user: %166
%166 = builtin "fcmp_olt_FPIEEE32"(%164 : $Builtin.FPIEEE32, %165 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %168
%167 = integer_literal $Builtin.Int1, -1 // user: %168
%168 = builtin "xor_Int1"(%166 : $Builtin.Int1, %167 : $Builtin.Int1) : $Builtin.Int1 // user: %169
cond_fail %168 : $Builtin.Int1 // id: %169
br bb9 // id: %170
bb15: // Preds: bb7
br bb16 // id: %171
bb16: // Preds: bb15
%172 = struct_extract %34 : $Float, #Float._value // user: %173
%173 = builtin "bitcast_FPIEEE32_Int32"(%172 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %175
%174 = integer_literal $Builtin.Int32, 23 // user: %175
%175 = builtin "lshr_Int32"(%173 : $Builtin.Int32, %174 : $Builtin.Int32) : $Builtin.Int32 // user: %176
%176 = builtin "zextOrBitCast_Int32_Int64"(%175 : $Builtin.Int32) : $Builtin.Int64 // user: %178
%177 = integer_literal $Builtin.Int64, 255 // users: %179, %178
%178 = builtin "and_Int64"(%176 : $Builtin.Int64, %177 : $Builtin.Int64) : $Builtin.Int64 // user: %179
%179 = builtin "cmp_ult_Int64"(%178 : $Builtin.Int64, %177 : $Builtin.Int64) : $Builtin.Int1 // user: %181
%180 = integer_literal $Builtin.Int1, -1 // user: %181
%181 = builtin "xor_Int1"(%179 : $Builtin.Int1, %180 : $Builtin.Int1) : $Builtin.Int1 // user: %182
cond_fail %181 : $Builtin.Int1 // id: %182
br bb8 // id: %183
bb17: // Preds: bb10
%184 = integer_literal $Builtin.Int32, 25 // user: %191
%185 = struct_extract %153 : $Int32, #Int32._value // users: %191, %188
br bb18 // id: %186
bb18: // Preds: bb17
%187 = integer_literal $Builtin.Int32, -2147483648 // user: %188
%188 = builtin "cmp_eq_Int32"(%185 : $Builtin.Int32, %187 : $Builtin.Int32) : $Builtin.Int1 // user: %189
cond_br %188, bb19, bb20 // id: %189
bb19: // Preds: bb18
br bb20 // id: %190
bb20: // Preds: bb19 bb18
%191 = builtin "sdiv_Int32"(%185 : $Builtin.Int32, %184 : $Builtin.Int32) : $Builtin.Int32 // user: %192
%192 = struct $Int32 (%191 : $Builtin.Int32) // users: %194, %200, %206
br bb21 // id: %193
bb21: // Preds: bb20
debug_value %192 : $Int32, let, name "bound" // id: %194
%195 = alloc_stack $IndexingIterator<Range<Int32>>, var, name "$i$generator" // users: %251, %226, %231
%196 = alloc_stack $Range<Int32> // users: %208, %222, %228
%197 = metatype $@thin Int32.Type
%198 = integer_literal $Builtin.Int32, 0 // users: %199, %213
%199 = struct $Int32 (%198 : $Builtin.Int32) // user: %204
%200 = struct_extract %192 : $Int32, #Int32._value // user: %213
br bb23 // id: %201
bb22: // Preds: bb24
%202 = metatype $@thin Range<Int32>.Type // user: %208
%203 = alloc_stack $Int32 // users: %204, %210, %208
store %199 to %203 : $*Int32 // id: %204
%205 = alloc_stack $Int32 // users: %206, %209, %208
store %192 to %205 : $*Int32 // id: %206
// function_ref Range.init(uncheckedBounds:)
%207 = function_ref @$SSn15uncheckedBoundsSnyxGx5lower_x5uppert_tcfC : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin Range<τ_0_0>.Type) -> @out Range<τ_0_0> // user: %208
%208 = apply %207<Int32>(%196, %203, %205, %202) : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin Range<τ_0_0>.Type) -> @out Range<τ_0_0>
dealloc_stack %205 : $*Int32 // id: %209
dealloc_stack %203 : $*Int32 // id: %210
br bb25 // id: %211
bb23: // Preds: bb21
br bb24 // id: %212
bb24: // Preds: bb23
%213 = builtin "cmp_slt_Int32"(%200 : $Builtin.Int32, %198 : $Builtin.Int32) : $Builtin.Int1 // user: %215
%214 = integer_literal $Builtin.Int1, -1 // user: %215
%215 = builtin "xor_Int1"(%213 : $Builtin.Int1, %214 : $Builtin.Int1) : $Builtin.Int1 // user: %216
%216 = struct $Bool (%215 : $Builtin.Int1) // user: %217
%217 = struct_extract %216 : $Bool, #Bool._value // user: %219
%218 = integer_literal $Builtin.Int1, -1 // user: %219
%219 = builtin "xor_Int1"(%217 : $Builtin.Int1, %218 : $Builtin.Int1) : $Builtin.Int1 // user: %220
cond_fail %219 : $Builtin.Int1 // id: %220
br bb22 // id: %221
bb25: // Preds: bb22
%222 = load %196 : $*Range<Int32> // user: %224
%223 = alloc_stack $Range<Int32> // users: %224, %227, %226
store %222 to %223 : $*Range<Int32> // id: %224
// function_ref Collection<>.makeIterator()
%225 = function_ref @$SSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0> // user: %226
%226 = apply %225<Range<Int32>>(%195, %223) : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
dealloc_stack %223 : $*Range<Int32> // id: %227
dealloc_stack %196 : $*Range<Int32> // id: %228
br bb26 // id: %229
bb26: // Preds: bb28 bb25
%230 = alloc_stack $Optional<Int32> // users: %235, %236, %233
%231 = begin_access [modify] [static] %195 : $*IndexingIterator<Range<Int32>> // users: %234, %233
// function_ref IndexingIterator.next()
%232 = function_ref @$Ss16IndexingIteratorV4next7ElementQzSgyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element> // user: %233
%233 = apply %232<Range<Int32>>(%230, %231) : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element>
end_access %231 : $*IndexingIterator<Range<Int32>> // id: %234
%235 = load %230 : $*Optional<Int32> // user: %237
dealloc_stack %230 : $*Optional<Int32> // id: %236
switch_enum %235 : $Optional<Int32>, case #Optional.some!enumelt.1: bb28, case #Optional.none!enumelt: bb27 // id: %237
bb27: // Preds: bb26
br bb29 // id: %238
// %239 // user: %240
bb28(%239 : $Int32): // Preds: bb26
debug_value %239 : $Int32, let, name "i" // id: %240
%241 = metatype $@thin Tensor<Double>.Type // user: %247
%242 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %243
%243 = struct $Double (%242 : $Builtin.FPIEEE64) // user: %245
%244 = alloc_stack $Double // users: %245, %248, %247
store %243 to %244 : $*Double // id: %245
// function_ref Tensor.init(_:)
%246 = function_ref @$S10TensorFlow0A0VyACyxGxcfC : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@in τ_0_0, @thin Tensor<τ_0_0>.Type) -> @owned Tensor<τ_0_0> // user: %247
%247 = apply %246<Double>(%244, %241) : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@in τ_0_0, @thin Tensor<τ_0_0>.Type) -> @owned Tensor<τ_0_0> // user: %249
dealloc_stack %244 : $*Double // id: %248
release_value %247 : $Tensor<Double> // id: %249
br bb26 // id: %250
bb29: // Preds: bb27
dealloc_stack %195 : $*IndexingIterator<Range<Int32>> // id: %251
br bb5 // id: %252
bb30: // Preds: bb6
dealloc_stack %103 : $*IndexingIterator<ClosedRange<Int>> // id: %253
release_value %23 : $Tensor<Float> // id: %254
%255 = tuple () // user: %256
return %255 : $() // id: %256
} // end sil function '$S4main5train14iterationCountySi_tF'
----
--- TFDeabstraction Result: $S4main5train14iterationCountySi_tF
// train(iterationCount:)
sil hidden @$S4main5train14iterationCountySi_tF : $@convention(thin) (Int) -> () {
// %0 // users: %234, %228, %192, %1
bb0(%0 : $Int):
debug_value %0 : $Int, let, name "iterationCount", argno 1 // id: %1
%2 = metatype $@thin TensorShape.Type // user: %20
%3 = integer_literal $Builtin.Word, 2 // user: %5
// function_ref _allocateUninitializedArray<A>(_:)
%4 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %5
%5 = apply %4<Int32>(%3) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %9, %6, %8
%6 = tuple_extract %5 : $(Array<Int32>, Builtin.RawPointer), 0 // users: %20, %7
retain_value %6 : $Array<Int32> // id: %7
%8 = tuple_extract %5 : $(Array<Int32>, Builtin.RawPointer), 1 // user: %10
release_value %5 : $(Array<Int32>, Builtin.RawPointer) // id: %9
%10 = pointer_to_address %8 : $Builtin.RawPointer to [strict] $*Int32 // users: %13, %15
%11 = integer_literal $Builtin.Int32, 1000 // user: %12
%12 = struct $Int32 (%11 : $Builtin.Int32) // user: %13
store %12 to %10 : $*Int32 // id: %13
%14 = integer_literal $Builtin.Word, 1 // user: %15
%15 = index_addr %10 : $*Int32, %14 : $Builtin.Word // user: %18
%16 = integer_literal $Builtin.Int32, 784 // user: %17
%17 = struct $Int32 (%16 : $Builtin.Int32) // user: %18
store %17 to %15 : $*Int32 // id: %18
// function_ref TensorShape.init(arrayLiteral:)
%19 = function_ref @$S10TensorFlow0A5ShapeV12arrayLiteralACs5Int32Vd_tcfC : $@convention(method) (@owned Array<Int32>, @thin TensorShape.Type) -> @owned TensorShape // user: %20
%20 = apply %19(%6, %2) : $@convention(method) (@owned Array<Int32>, @thin TensorShape.Type) -> @owned TensorShape // users: %81, %77, %32, %21
retain_value %20 : $TensorShape // id: %21
%22 = alloc_stack $Float // users: %46, %30, %79
%23 = metatype $@thick Float.Type // user: %30
%24 = alloc_stack $Int64 // users: %30, %28, %31
%25 = metatype $@thick Int64.Type // user: %28
%26 = integer_literal $Builtin.Int2048, 1 // user: %28
// function_ref protocol witness for _ExpressibleByBuiltinIntegerLiteral.init(_builtinIntegerLiteral:) in conformance Int64
%27 = function_ref @$Ss5Int64Vs35_ExpressibleByBuiltinIntegerLiteralssACP08_builtineF0xBi2048__tcfCTW : $@convention(witness_method: _ExpressibleByBuiltinIntegerLiteral) (Builtin.Int2048, @thick Int64.Type) -> @out Int64 // user: %28
%28 = apply %27(%24, %26, %25) : $@convention(witness_method: _ExpressibleByBuiltinIntegerLiteral) (Builtin.Int2048, @thick Int64.Type) -> @out Int64
// function_ref protocol witness for ExpressibleByIntegerLiteral.init(integerLiteral:) in conformance Float
%29 = function_ref @$SSfs27ExpressibleByIntegerLiteralssAAP07integerD0x0cD4TypeQz_tcfCTW : $@convention(witness_method: ExpressibleByIntegerLiteral) (@in Int64, @thick Float.Type) -> @out Float // user: %30
%30 = apply %29(%22, %24, %23) : $@convention(witness_method: ExpressibleByIntegerLiteral) (@in Int64, @thick Float.Type) -> @out Float
dealloc_stack %24 : $*Int64 // id: %31
%32 = struct_extract %20 : $TensorShape, #TensorShape.dimensions // users: %44, %33
retain_value %32 : $Array<Int32> // id: %33
%34 = graph_op "Const"() {dtype: $Int32, value$tensor: [$Int32: (i32 1000), (i32 784)], value$shape: [$Int32: i32 2], __device: "/device:CPU:0"} : $TensorHandle<Int32> // users: %61, %37, %38, %43, %45, %59, %63, %75
%35 = alloc_stack $Tensor<Int32> // users: %36, %39, %42
%36 = struct_element_addr %35 : $*Tensor<Int32>, #Tensor.handle // user: %37
store %34 to %36 : $*TensorHandle<Int32> // id: %37
strong_retain %34 : $TensorHandle<Int32> // id: %38
%39 = load %35 : $*Tensor<Int32> // user: %40
%40 = struct_extract %39 : $Tensor<Int32>, #Tensor.handle // user: %41
strong_release %40 : $TensorHandle<Int32> // id: %41
dealloc_stack %35 : $*Tensor<Int32> // id: %42
strong_retain %34 : $TensorHandle<Int32> // id: %43
release_value %32 : $Array<Int32> // id: %44
strong_release %34 : $TensorHandle<Int32> // id: %45
%46 = load %22 : $*Float // user: %47
%47 = struct_extract %46 : $Float, #Float._value // user: %48
%48 = graph_op "tfc.scalarToTensor,s"(%47 : $Builtin.FPIEEE32) {__device: "/device:CPU:0"} : $TensorHandle<Float> // users: %61, %51, %52, %57, %58, %60, %62, %74
%49 = alloc_stack $Tensor<Float> // users: %50, %53, %56
%50 = struct_element_addr %49 : $*Tensor<Float>, #Tensor.handle // user: %51
store %48 to %50 : $*TensorHandle<Float> // id: %51
strong_retain %48 : $TensorHandle<Float> // id: %52
%53 = load %49 : $*Tensor<Float> // user: %54
%54 = struct_extract %53 : $Tensor<Float>, #Tensor.handle // user: %55
strong_release %54 : $TensorHandle<Float> // id: %55
dealloc_stack %49 : $*Tensor<Float> // id: %56
strong_retain %48 : $TensorHandle<Float> // id: %57
strong_release %48 : $TensorHandle<Float> // id: %58
strong_retain %34 : $TensorHandle<Int32> // id: %59
strong_retain %48 : $TensorHandle<Float> // id: %60
%61 = graph_op "Fill,i,i"(%34 : $TensorHandle<Int32>, %48 : $TensorHandle<Float>) {T: $Float, index_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Float> // users: %85, %67, %64, %68, %73, %76, %78, %80, %82, %84, %86, %377
strong_release %48 : $TensorHandle<Float> // id: %62
strong_release %34 : $TensorHandle<Int32> // id: %63
strong_retain %61 : $TensorHandle<Float> // id: %64
%65 = alloc_stack $Tensor<Float> // users: %66, %69, %72
%66 = struct_element_addr %65 : $*Tensor<Float>, #Tensor.handle // user: %67
store %61 to %66 : $*TensorHandle<Float> // id: %67
strong_retain %61 : $TensorHandle<Float> // id: %68
%69 = load %65 : $*Tensor<Float> // user: %70
%70 = struct_extract %69 : $Tensor<Float>, #Tensor.handle // user: %71
strong_release %70 : $TensorHandle<Float> // id: %71
dealloc_stack %65 : $*Tensor<Float> // id: %72
strong_release %61 : $TensorHandle<Float> // id: %73
strong_release %48 : $TensorHandle<Float> // id: %74
strong_release %34 : $TensorHandle<Int32> // id: %75
strong_retain %61 : $TensorHandle<Float> // id: %76
release_value %20 : $TensorShape // id: %77
strong_release %61 : $TensorHandle<Float> // id: %78
dealloc_stack %22 : $*Float // id: %79
strong_retain %61 : $TensorHandle<Float> // id: %80
release_value %20 : $TensorShape // id: %81
strong_release %61 : $TensorHandle<Float> // id: %82
%83 = metatype $@thin TensorShape.Type // user: %145
strong_retain %61 : $TensorHandle<Float> // id: %84
%85 = graph_op "Shape,i"(%61 : $TensorHandle<Float>) {T: $Float, out_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Int32> // users: %90, %91, %87, %92, %97, %114, %117, %143
strong_release %61 : $TensorHandle<Float> // id: %86
strong_retain %85 : $TensorHandle<Int32> // id: %87
%88 = alloc_stack $Tensor<Int32> // users: %89, %93, %96
%89 = struct_element_addr %88 : $*Tensor<Int32>, #Tensor.handle // user: %90
store %85 to %89 : $*TensorHandle<Int32> // id: %90
%91 = struct $Tensor<Int32> (%85 : $TensorHandle<Int32>) // user: %113
strong_retain %85 : $TensorHandle<Int32> // id: %92
%93 = load %88 : $*Tensor<Int32> // user: %94
%94 = struct_extract %93 : $Tensor<Int32>, #Tensor.handle // user: %95
strong_release %94 : $TensorHandle<Int32> // id: %95
dealloc_stack %88 : $*Tensor<Int32> // id: %96
strong_release %85 : $TensorHandle<Int32> // id: %97
// function_ref implicit closure #1 in Tensor.array.getter
%98 = function_ref @$S10TensorFlow0A0V5arrayAA11ShapedArrayVyxGvgSSyXKfu_ : $@convention(thin) () -> @owned String // user: %99
%99 = convert_function %98 : $@convention(thin) () -> @owned String to $@convention(thin) @noescape () -> @owned String // user: %100
%100 = thin_to_thick_function %99 : $@convention(thin) @noescape () -> @owned String to $@noescape @callee_guaranteed () -> @owned String // user: %112
%101 = string_literal utf8 "/Users/danielzheng/swift-dan/swift/stdlib/public/TensorFlow/Tensor.swift" // user: %103
%102 = integer_literal $Builtin.Word, 72 // user: %107
%103 = builtin "ptrtoint_Word"(%101 : $Builtin.RawPointer) : $Builtin.Word // user: %107
br bb1 // id: %104
bb1: // Preds: bb0
%105 = integer_literal $Builtin.Int8, 2 // user: %107
br bb2 // id: %106
bb2: // Preds: bb1
%107 = struct $StaticString (%103 : $Builtin.Word, %102 : $Builtin.Word, %105 : $Builtin.Int8) // user: %112
br bb3 // id: %108
bb3: // Preds: bb2
%109 = integer_literal $Builtin.Int64, 863 // user: %110
%110 = struct $UInt (%109 : $Builtin.Int64) // user: %112
// function_ref debugLog(_:file:line:)
%111 = function_ref @$S10TensorFlow8debugLog_4file4lineySSyXK_s12StaticStringVSutF : $@convention(thin) (@noescape @callee_guaranteed () -> @owned String, StaticString, UInt) -> () // user: %112
%112 = apply %111(%100, %107, %110) : $@convention(thin) (@noescape @callee_guaranteed () -> @owned String, StaticString, UInt) -> ()
%113 = struct_extract %91 : $Tensor<Int32>, #Tensor.handle // user: %116
strong_retain %85 : $TensorHandle<Int32> // id: %114
// function_ref __tf_receive
%115 = function_ref @__tf_receive : $@convention(thin) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned TensorHandle<τ_0_0> // user: %116
%116 = apply %115<Int32>(%113) : $@convention(thin) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned TensorHandle<τ_0_0> // users: %132, %131, %128, %122, %121, %120
strong_release %85 : $TensorHandle<Int32> // id: %117
%118 = alloc_stack $Tensor<Int32> // users: %119, %123, %126
%119 = struct_element_addr %118 : $*Tensor<Int32>, #Tensor.handle // user: %120
store %116 to %119 : $*TensorHandle<Int32> // id: %120
%121 = struct $Tensor<Int32> (%116 : $TensorHandle<Int32>) // user: %127
strong_retain %116 : $TensorHandle<Int32> // id: %122
%123 = load %118 : $*Tensor<Int32> // user: %124
%124 = struct_extract %123 : $Tensor<Int32>, #Tensor.handle // user: %125
strong_release %124 : $TensorHandle<Int32> // id: %125
dealloc_stack %118 : $*Tensor<Int32> // id: %126
%127 = struct_extract %121 : $Tensor<Int32>, #Tensor.handle // user: %130
strong_retain %116 : $TensorHandle<Int32> // id: %128
// function_ref TensorHandle.makeHostCopy()
%129 = function_ref @$S10TensorFlow0A6HandleC12makeHostCopyAA11ShapedArrayVyxGyF : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned ShapedArray<τ_0_0> // user: %130
%130 = apply %129<Int32>(%127) : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned ShapedArray<τ_0_0> // user: %133
strong_release %116 : $TensorHandle<Int32> // id: %131
strong_release %116 : $TensorHandle<Int32> // id: %132
br bb4(%130 : $ShapedArray<Int32>) // id: %133
// %134 // user: %136
bb4(%134 : $ShapedArray<Int32>): // Preds: bb3
%135 = alloc_stack $ShapedArray<Int32> // users: %140, %139, %138, %136
store %134 to %135 : $*ShapedArray<Int32> // id: %136
// function_ref _ShapedArrayProtocol.scalars.getter
%137 = function_ref @$S10TensorFlow20_ShapedArrayProtocolPAAE7scalarsSay6ScalarQzGvg : $@convention(method) <τ_0_0 where τ_0_0 : _ShapedArrayProtocol> (@in_guaranteed τ_0_0) -> @owned Array<τ_0_0.Scalar> // user: %138
%138 = apply %137<ShapedArray<Int32>>(%135) : $@convention(method) <τ_0_0 where τ_0_0 : _ShapedArrayProtocol> (@in_guaranteed τ_0_0) -> @owned Array<τ_0_0.Scalar> // user: %141
destroy_addr %135 : $*ShapedArray<Int32> // id: %139
dealloc_stack %135 : $*ShapedArray<Int32> // id: %140
br bb5(%138 : $Array<Int32>) // id: %141
// %142 // user: %145
bb5(%142 : $Array<Int32>): // Preds: bb4
strong_release %85 : $TensorHandle<Int32> // id: %143
// function_ref TensorShape.init(_:)
%144 = function_ref @$S10TensorFlow0A5ShapeVyACSays5Int32VGcfC : $@convention(method) (@owned Array<Int32>, @thin TensorShape.Type) -> @owned TensorShape // user: %145
%145 = apply %144(%142, %83) : $@convention(method) (@owned Array<Int32>, @thin TensorShape.Type) -> @owned TensorShape // user: %146
br bb6(%145 : $TensorShape) // id: %146
// %147 // users: %151, %152
bb6(%147 : $TensorShape): // Preds: bb5
%148 = integer_literal $Builtin.Int32, 0 // user: %149
%149 = struct $Int32 (%148 : $Builtin.Int32) // user: %151
// function_ref TensorShape.subscript.getter
%150 = function_ref @$S10TensorFlow0A5ShapeVys5Int32VAEcig : $@convention(method) (Int32, @guaranteed TensorShape) -> Int32 // user: %151
%151 = apply %150(%149, %147) : $@convention(method) (Int32, @guaranteed TensorShape) -> Int32 // user: %153
release_value %147 : $TensorShape // id: %152
%153 = struct_extract %151 : $Int32, #Int32._value // user: %154
%154 = builtin "sitofp_Int32_FPIEEE32"(%153 : $Builtin.Int32) : $Builtin.FPIEEE32 // user: %155
%155 = struct $Float (%154 : $Builtin.FPIEEE32) // users: %292, %285, %277, %271, %156
debug_value %155 : $Float, let, name "batchSize" // id: %156
%157 = integer_literal $Builtin.Word, 1 // user: %159
// function_ref _allocateUninitializedArray<A>(_:)
%158 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %159
%159 = apply %158<Any>(%157) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %163, %160, %162
%160 = tuple_extract %159 : $(Array<Any>, Builtin.RawPointer), 0 // users: %223, %220, %161
retain_value %160 : $Array<Any> // id: %161
%162 = tuple_extract %159 : $(Array<Any>, Builtin.RawPointer), 1 // user: %164
release_value %159 : $(Array<Any>, Builtin.RawPointer) // id: %163
%164 = pointer_to_address %162 : $Builtin.RawPointer to [strict] $*Any // user: %165
%165 = init_existential_addr %164 : $*Any, $String // user: %214
%166 = metatype $@thin String.Type // user: %213
%167 = integer_literal $Builtin.Word, 3 // user: %169
// function_ref _allocateUninitializedArray<A>(_:)
%168 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %169
%169 = apply %168<String>(%167) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // users: %173, %170, %172
%170 = tuple_extract %169 : $(Array<String>, Builtin.RawPointer), 0 // users: %213, %171
retain_value %170 : $Array<String> // id: %171
%172 = tuple_extract %169 : $(Array<String>, Builtin.RawPointer), 1 // user: %174
release_value %169 : $(Array<String>, Builtin.RawPointer) // id: %173
%174 = pointer_to_address %172 : $Builtin.RawPointer to [strict] $*String // users: %187, %198, %189
%175 = metatype $@thin String.Type // user: %185
%176 = string_literal utf8 "Begin training for " // user: %181
%177 = integer_literal $Builtin.Word, 19 // user: %181
%178 = integer_literal $Builtin.Int1, -1 // user: %181
%179 = metatype $@thin String.Type // user: %181
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%180 = function_ref @$SSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %181
%181 = apply %180(%176, %177, %178, %179) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %183
%182 = alloc_stack $String // users: %183, %186, %185
store %181 to %182 : $*String // id: %183
// function_ref String.init<A>(stringInterpolationSegment:)
%184 = function_ref @$SSS26stringInterpolationSegmentSSx_tcs23CustomStringConvertibleRzs20TextOutputStreamableRzlufC : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %185
%185 = apply %184<String>(%182, %175) : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %187
dealloc_stack %182 : $*String // id: %186
store %185 to %174 : $*String // id: %187
%188 = integer_literal $Builtin.Word, 1 // user: %189
%189 = index_addr %174 : $*String, %188 : $Builtin.Word // user: %196
%190 = metatype $@thin String.Type // user: %194
%191 = alloc_stack $Int // users: %192, %195, %194
store %0 to %191 : $*Int // id: %192
// function_ref String.init<A>(stringInterpolationSegment:)
%193 = function_ref @$SSS26stringInterpolationSegmentSSx_tcs23CustomStringConvertibleRzlufC : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in τ_0_0, @thin String.Type) -> @owned String // user: %194
%194 = apply %193<Int>(%191, %190) : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in τ_0_0, @thin String.Type) -> @owned String // user: %196
dealloc_stack %191 : $*Int // id: %195
store %194 to %189 : $*String // id: %196
%197 = integer_literal $Builtin.Word, 2 // user: %198
%198 = index_addr %174 : $*String, %197 : $Builtin.Word // user: %211
%199 = metatype $@thin String.Type // user: %209
%200 = string_literal utf8 " iterations." // user: %205
%201 = integer_literal $Builtin.Word, 12 // user: %205
%202 = integer_literal $Builtin.Int1, -1 // user: %205
%203 = metatype $@thin String.Type // user: %205
// function_ref String.init(_builtinStringLiteral:utf8CodeUnitCount:isASCII:)
%204 = function_ref @$SSS21_builtinStringLiteral17utf8CodeUnitCount7isASCIISSBp_BwBi1_tcfC : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %205
%205 = apply %204(%200, %201, %202, %203) : $@convention(method) (Builtin.RawPointer, Builtin.Word, Builtin.Int1, @thin String.Type) -> @owned String // user: %207
%206 = alloc_stack $String // users: %207, %210, %209
store %205 to %206 : $*String // id: %207
// function_ref String.init<A>(stringInterpolationSegment:)
%208 = function_ref @$SSS26stringInterpolationSegmentSSx_tcs23CustomStringConvertibleRzs20TextOutputStreamableRzlufC : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %209
%209 = apply %208<String>(%206, %199) : $@convention(method) <τ_0_0 where τ_0_0 : CustomStringConvertible, τ_0_0 : TextOutputStreamable> (@in τ_0_0, @thin String.Type) -> @owned String // user: %211
dealloc_stack %206 : $*String // id: %210
store %209 to %198 : $*String // id: %211
// function_ref String.init(stringInterpolation:)
%212 = function_ref @$SSS19stringInterpolationS2Sd_tcfC : $@convention(method) (@owned Array<String>, @thin String.Type) -> @owned String // user: %213
%213 = apply %212(%170, %166) : $@convention(method) (@owned Array<String>, @thin String.Type) -> @owned String // user: %214
store %213 to %165 : $*String // id: %214
// function_ref default argument 1 of print(_:separator:terminator:)
%215 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String // user: %216
%216 = apply %215() : $@convention(thin) () -> @owned String // users: %222, %220
// function_ref default argument 2 of print(_:separator:terminator:)
%217 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String // user: %218
%218 = apply %217() : $@convention(thin) () -> @owned String // users: %221, %220
// function_ref print(_:separator:terminator:)
%219 = function_ref @$Ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () // user: %220
%220 = apply %219(%160, %216, %218) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> ()
release_value %218 : $String // id: %221
release_value %216 : $String // id: %222
release_value %160 : $Array<Any> // id: %223
%224 = alloc_stack $IndexingIterator<ClosedRange<Int>>, var, name "$generator" // users: %376, %254, %259
%225 = alloc_stack $ClosedRange<Int> // users: %236, %250, %256
%226 = integer_literal $Builtin.Int64, 0 // users: %227, %241
%227 = struct $Int (%226 : $Builtin.Int64) // user: %232
%228 = struct_extract %0 : $Int, #Int._value // user: %241
br bb8 // id: %229
bb7: // Preds: bb9
%230 = metatype $@thin ClosedRange<Int>.Type // user: %236
%231 = alloc_stack $Int // users: %232, %238, %236
store %227 to %231 : $*Int // id: %232
%233 = alloc_stack $Int // users: %234, %237, %236
store %0 to %233 : $*Int // id: %234
// function_ref ClosedRange.init(uncheckedBounds:)
%235 = function_ref @$SSN15uncheckedBoundsSNyxGx5lower_x5uppert_tcfC : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin ClosedRange<τ_0_0>.Type) -> @out ClosedRange<τ_0_0> // user: %236
%236 = apply %235<Int>(%225, %231, %233, %230) : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin ClosedRange<τ_0_0>.Type) -> @out ClosedRange<τ_0_0>
dealloc_stack %233 : $*Int // id: %237
dealloc_stack %231 : $*Int // id: %238
br bb10 // id: %239
bb8: // Preds: bb6
br bb9 // id: %240
bb9: // Preds: bb8
%241 = builtin "cmp_slt_Int64"(%228 : $Builtin.Int64, %226 : $Builtin.Int64) : $Builtin.Int1 // user: %243
%242 = integer_literal $Builtin.Int1, -1 // user: %243
%243 = builtin "xor_Int1"(%241 : $Builtin.Int1, %242 : $Builtin.Int1) : $Builtin.Int1 // user: %244
%244 = struct $Bool (%243 : $Builtin.Int1) // user: %245
%245 = struct_extract %244 : $Bool, #Bool._value // user: %247
%246 = integer_literal $Builtin.Int1, -1 // user: %247
%247 = builtin "xor_Int1"(%245 : $Builtin.Int1, %246 : $Builtin.Int1) : $Builtin.Int1 // user: %248
cond_fail %247 : $Builtin.Int1 // id: %248
br bb7 // id: %249
bb10: // Preds: bb7
%250 = load %225 : $*ClosedRange<Int> // user: %252
%251 = alloc_stack $ClosedRange<Int> // users: %252, %255, %254
store %250 to %251 : $*ClosedRange<Int> // id: %252
// function_ref Collection<>.makeIterator()
%253 = function_ref @$SSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0> // user: %254
%254 = apply %253<ClosedRange<Int>>(%224, %251) : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
dealloc_stack %251 : $*ClosedRange<Int> // id: %255
dealloc_stack %225 : $*ClosedRange<Int> // id: %256
br bb11 // id: %257
bb11: // Preds: bb35 bb10
%258 = alloc_stack $Optional<Int> // users: %263, %264, %261
%259 = begin_access [modify] [static] %224 : $*IndexingIterator<ClosedRange<Int>> // users: %262, %261
// function_ref IndexingIterator.next()
%260 = function_ref @$Ss16IndexingIteratorV4next7ElementQzSgyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element> // user: %261
%261 = apply %260<ClosedRange<Int>>(%258, %259) : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element>
end_access %259 : $*IndexingIterator<ClosedRange<Int>> // id: %262
%263 = load %258 : $*Optional<Int> // user: %265
dealloc_stack %258 : $*Optional<Int> // id: %264
switch_enum %263 : $Optional<Int>, case #Optional.some!enumelt.1: bb13, case #Optional.none!enumelt: bb12 // id: %265
bb12: // Preds: bb11
br bb36 // id: %266
bb13(%267 : $Int): // Preds: bb11
br bb21 // id: %268
bb14: // Preds: bb22
br bb19 // id: %269
bb15: // Preds: bb20
br bb17 // id: %270
bb16: // Preds: bb18
%271 = struct_extract %155 : $Float, #Float._value // user: %272
%272 = builtin "fptosi_FPIEEE32_Int32"(%271 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %273
%273 = struct $Int32 (%272 : $Builtin.Int32) // user: %305
br bb23 // id: %274
bb17: // Preds: bb15
br bb18 // id: %275
bb18: // Preds: bb17
%276 = float_literal $Builtin.FPIEEE32, 0x4F000000 // 2.14748365E+9 // user: %278
%277 = struct_extract %155 : $Float, #Float._value // user: %278
%278 = builtin "fcmp_olt_FPIEEE32"(%277 : $Builtin.FPIEEE32, %276 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %280
%279 = integer_literal $Builtin.Int1, -1 // user: %280
%280 = builtin "xor_Int1"(%278 : $Builtin.Int1, %279 : $Builtin.Int1) : $Builtin.Int1 // user: %281
cond_fail %280 : $Builtin.Int1 // id: %281
br bb16 // id: %282
bb19: // Preds: bb14
br bb20 // id: %283
bb20: // Preds: bb19
%284 = float_literal $Builtin.FPIEEE32, 0xCF000001 // -2.1474839E+9 // user: %286
%285 = struct_extract %155 : $Float, #Float._value // user: %286
%286 = builtin "fcmp_olt_FPIEEE32"(%284 : $Builtin.FPIEEE32, %285 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %288
%287 = integer_literal $Builtin.Int1, -1 // user: %288
%288 = builtin "xor_Int1"(%286 : $Builtin.Int1, %287 : $Builtin.Int1) : $Builtin.Int1 // user: %289
cond_fail %288 : $Builtin.Int1 // id: %289
br bb15 // id: %290
bb21: // Preds: bb13
br bb22 // id: %291
bb22: // Preds: bb21
%292 = struct_extract %155 : $Float, #Float._value // user: %293
%293 = builtin "bitcast_FPIEEE32_Int32"(%292 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %295
%294 = integer_literal $Builtin.Int32, 23 // user: %295
%295 = builtin "lshr_Int32"(%293 : $Builtin.Int32, %294 : $Builtin.Int32) : $Builtin.Int32 // user: %296
%296 = builtin "zextOrBitCast_Int32_Int64"(%295 : $Builtin.Int32) : $Builtin.Int64 // user: %298
%297 = integer_literal $Builtin.Int64, 255 // users: %299, %298
%298 = builtin "and_Int64"(%296 : $Builtin.Int64, %297 : $Builtin.Int64) : $Builtin.Int64 // user: %299
%299 = builtin "cmp_ult_Int64"(%298 : $Builtin.Int64, %297 : $Builtin.Int64) : $Builtin.Int1 // user: %301
%300 = integer_literal $Builtin.Int1, -1 // user: %301
%301 = builtin "xor_Int1"(%299 : $Builtin.Int1, %300 : $Builtin.Int1) : $Builtin.Int1 // user: %302
cond_fail %301 : $Builtin.Int1 // id: %302
br bb14 // id: %303
bb23: // Preds: bb16
%304 = integer_literal $Builtin.Int32, 25 // user: %311
%305 = struct_extract %273 : $Int32, #Int32._value // users: %311, %308
br bb24 // id: %306
bb24: // Preds: bb23
%307 = integer_literal $Builtin.Int32, -2147483648 // user: %308
%308 = builtin "cmp_eq_Int32"(%305 : $Builtin.Int32, %307 : $Builtin.Int32) : $Builtin.Int1 // user: %309
cond_br %308, bb25, bb26 // id: %309
bb25: // Preds: bb24
br bb26 // id: %310
bb26: // Preds: bb25 bb24
%311 = builtin "sdiv_Int32"(%305 : $Builtin.Int32, %304 : $Builtin.Int32) : $Builtin.Int32 // user: %312
%312 = struct $Int32 (%311 : $Builtin.Int32) // users: %314, %319, %325
br bb27 // id: %313
bb27: // Preds: bb26
debug_value %312 : $Int32, let, name "bound" // id: %314
%315 = alloc_stack $IndexingIterator<Range<Int32>>, var, name "$i$generator" // users: %374, %345, %350
%316 = alloc_stack $Range<Int32> // users: %327, %341, %347
%317 = integer_literal $Builtin.Int32, 0 // users: %318, %332
%318 = struct $Int32 (%317 : $Builtin.Int32) // user: %323
%319 = struct_extract %312 : $Int32, #Int32._value // user: %332
br bb29 // id: %320
bb28: // Preds: bb30
%321 = metatype $@thin Range<Int32>.Type // user: %327
%322 = alloc_stack $Int32 // users: %323, %329, %327
store %318 to %322 : $*Int32 // id: %323
%324 = alloc_stack $Int32 // users: %325, %328, %327
store %312 to %324 : $*Int32 // id: %325
// function_ref Range.init(uncheckedBounds:)
%326 = function_ref @$SSn15uncheckedBoundsSnyxGx5lower_x5uppert_tcfC : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin Range<τ_0_0>.Type) -> @out Range<τ_0_0> // user: %327
%327 = apply %326<Int32>(%316, %322, %324, %321) : $@convention(method) <τ_0_0 where τ_0_0 : Comparable> (@in τ_0_0, @in τ_0_0, @thin Range<τ_0_0>.Type) -> @out Range<τ_0_0>
dealloc_stack %324 : $*Int32 // id: %328
dealloc_stack %322 : $*Int32 // id: %329
br bb31 // id: %330
bb29: // Preds: bb27
br bb30 // id: %331
bb30: // Preds: bb29
%332 = builtin "cmp_slt_Int32"(%319 : $Builtin.Int32, %317 : $Builtin.Int32) : $Builtin.Int1 // user: %334
%333 = integer_literal $Builtin.Int1, -1 // user: %334
%334 = builtin "xor_Int1"(%332 : $Builtin.Int1, %333 : $Builtin.Int1) : $Builtin.Int1 // user: %335
%335 = struct $Bool (%334 : $Builtin.Int1) // user: %336
%336 = struct_extract %335 : $Bool, #Bool._value // user: %338
%337 = integer_literal $Builtin.Int1, -1 // user: %338
%338 = builtin "xor_Int1"(%336 : $Builtin.Int1, %337 : $Builtin.Int1) : $Builtin.Int1 // user: %339
cond_fail %338 : $Builtin.Int1 // id: %339
br bb28 // id: %340
bb31: // Preds: bb28
%341 = load %316 : $*Range<Int32> // user: %343
%342 = alloc_stack $Range<Int32> // users: %343, %346, %345
store %341 to %342 : $*Range<Int32> // id: %343
// function_ref Collection<>.makeIterator()
%344 = function_ref @$SSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0> // user: %345
%345 = apply %344<Range<Int32>>(%315, %342) : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in_guaranteed τ_0_0) -> @out IndexingIterator<τ_0_0>
dealloc_stack %342 : $*Range<Int32> // id: %346
dealloc_stack %316 : $*Range<Int32> // id: %347
br bb32 // id: %348
bb32: // Preds: bb34 bb31
%349 = alloc_stack $Optional<Int32> // users: %354, %355, %352
%350 = begin_access [modify] [static] %315 : $*IndexingIterator<Range<Int32>> // users: %353, %352
// function_ref IndexingIterator.next()
%351 = function_ref @$Ss16IndexingIteratorV4next7ElementQzSgyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element> // user: %352
%352 = apply %351<Range<Int32>>(%349, %350) : $@convention(method) <τ_0_0 where τ_0_0 : Collection> (@inout IndexingIterator<τ_0_0>) -> @out Optional<τ_0_0.Element>
end_access %350 : $*IndexingIterator<Range<Int32>> // id: %353
%354 = load %349 : $*Optional<Int32> // user: %356
dealloc_stack %349 : $*Optional<Int32> // id: %355
switch_enum %354 : $Optional<Int32>, case #Optional.some!enumelt.1: bb34, case #Optional.none!enumelt: bb33 // id: %356
bb33: // Preds: bb32
br bb35 // id: %357
// %358 // user: %359
bb34(%358 : $Int32): // Preds: bb32
debug_value %358 : $Int32, let, name "i" // id: %359
%360 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %361
%361 = graph_op "tfc.scalarToTensor,s"(%360 : $Builtin.FPIEEE64) {__device: "/device:CPU:0"} : $TensorHandle<Double> // users: %364, %365, %370, %371, %372
%362 = alloc_stack $Tensor<Double> // users: %363, %366, %369
%363 = struct_element_addr %362 : $*Tensor<Double>, #Tensor.handle // user: %364
store %361 to %363 : $*TensorHandle<Double> // id: %364
strong_retain %361 : $TensorHandle<Double> // id: %365
%366 = load %362 : $*Tensor<Double> // user: %367
%367 = struct_extract %366 : $Tensor<Double>, #Tensor.handle // user: %368
strong_release %367 : $TensorHandle<Double> // id: %368
dealloc_stack %362 : $*Tensor<Double> // id: %369
strong_retain %361 : $TensorHandle<Double> // id: %370
strong_release %361 : $TensorHandle<Double> // id: %371
strong_release %361 : $TensorHandle<Double> // id: %372
br bb32 // id: %373
bb35: // Preds: bb33
dealloc_stack %315 : $*IndexingIterator<Range<Int32>> // id: %374
br bb11 // id: %375
bb36: // Preds: bb12
dealloc_stack %224 : $*IndexingIterator<ClosedRange<Int>> // id: %376
strong_release %61 : $TensorHandle<Float> // id: %377
%378 = tuple () // user: %379
return %378 : $() // id: %379
} // end sil function '$S4main5train14iterationCountySi_tF'
----
---- INPUT FUNCTION $S4main5train14iterationCountySi_tF ----------
// train(iterationCount:)
sil hidden @$S4main5train14iterationCountySi_tF : $@convention(thin) (Int) -> () {
// %0 // users: %107, %141, %1
bb0(%0 : $Int):
debug_value %0 : $Int, let, name "iterationCount", argno 1 // id: %1
%2 = integer_literal $Builtin.Word, 2 // user: %112
%3 = integer_literal $Builtin.Word, 1 // users: %105, %56
%4 = integer_literal $Builtin.Int64, 1 // users: %177, %204, %55, %5
%5 = builtin "sitofp_Int64_FPIEEE32"(%4 : $Builtin.Int64) : $Builtin.FPIEEE32 // user: %7
%6 = graph_op "Const"() {dtype: $Int32, value$tensor: [$Int32: (i32 1000), (i32 784)], value$shape: [$Int32: i32 2], __device: "/device:CPU:0"} : $TensorHandle<Int32> // users: %10, %8
%7 = graph_op "tfc.scalarToTensor,s"(%5 : $Builtin.FPIEEE32) {__device: "/device:CPU:0"} : $TensorHandle<Float> // users: %9, %8
%8 = graph_op "Fill,i,i"(%6 : $TensorHandle<Int32>, %7 : $TensorHandle<Float>) {T: $Float, index_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Float> // users: %169, %11
strong_release %7 : $TensorHandle<Float> // id: %9
strong_release %6 : $TensorHandle<Int32> // id: %10
%11 = graph_op "Shape,i"(%8 : $TensorHandle<Float>) {T: $Float, out_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Int32> // users: %27, %42, %25, %26
// function_ref implicit closure #1 in Tensor.array.getter
%12 = function_ref @$S10TensorFlow0A0V5arrayAA11ShapedArrayVyxGvgSSyXKfu_ : $@convention(thin) () -> @owned String // user: %13
%13 = convert_function %12 : $@convention(thin) () -> @owned String to $@convention(thin) @noescape () -> @owned String // user: %14
%14 = thin_to_thick_function %13 : $@convention(thin) @noescape () -> @owned String to $@noescape @callee_guaranteed () -> @owned String // user: %23
%15 = string_literal utf8 "/Users/danielzheng/swift-dan/swift/stdlib/public/TensorFlow/Tensor.swift" // user: %17
%16 = integer_literal $Builtin.Word, 72 // user: %19
%17 = builtin "ptrtoint_Word"(%15 : $Builtin.RawPointer) : $Builtin.Word // user: %19
%18 = integer_literal $Builtin.Int8, 2 // user: %19
%19 = struct $StaticString (%17 : $Builtin.Word, %16 : $Builtin.Word, %18 : $Builtin.Int8) // user: %23
%20 = integer_literal $Builtin.Int64, 863 // user: %21
%21 = struct $UInt (%20 : $Builtin.Int64) // user: %23
// function_ref debugLog(_:file:line:)
%22 = function_ref @$S10TensorFlow8debugLog_4file4lineySSyXK_s12StaticStringVSutF : $@convention(thin) (@noescape @callee_guaranteed () -> @owned String, StaticString, UInt) -> () // user: %23
%23 = apply %22(%14, %19, %21) : $@convention(thin) (@noescape @callee_guaranteed () -> @owned String, StaticString, UInt) -> ()
// function_ref __tf_receive
%24 = function_ref @__tf_receive : $@convention(thin) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned TensorHandle<τ_0_0> // user: %26
strong_retain %11 : $TensorHandle<Int32> // id: %25
%26 = apply %24<Int32>(%11) : $@convention(thin) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned TensorHandle<τ_0_0> // users: %31, %32, %29, %30
strong_release %11 : $TensorHandle<Int32> // id: %27
// function_ref TensorHandle.makeHostCopy()
%28 = function_ref @$S10TensorFlow0A6HandleC12makeHostCopyAA11ShapedArrayVyxGyF : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned ShapedArray<τ_0_0> // user: %30
strong_retain %26 : $TensorHandle<Int32> // id: %29
%30 = apply %28<Int32>(%26) : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned ShapedArray<τ_0_0> // users: %39, %37, %34
strong_release %26 : $TensorHandle<Int32> // id: %31
strong_release %26 : $TensorHandle<Int32> // id: %32
%33 = alloc_stack $ShapedArray<Int32> // users: %41, %36, %34
store %30 to %33 : $*ShapedArray<Int32> // id: %34
// function_ref _ShapedArrayProtocol.scalars.getter
%35 = function_ref @$S10TensorFlow20_ShapedArrayProtocolPAAE7scalarsSay6ScalarQzGvg : $@convention(method) <τ_0_0 where τ_0_0 : _ShapedArrayProtocol> (@in_guaranteed τ_0_0) -> @owned Array<τ_0_0.Scalar> // user: %36
%36 = apply %35<ShapedArray<Int32>>(%33) : $@convention(method) <τ_0_0 where τ_0_0 : _ShapedArrayProtocol> (@in_guaranteed τ_0_0) -> @owned Array<τ_0_0.Scalar> // users: %51, %52, %46, %50
%37 = struct_extract %30 : $ShapedArray<Int32>, #ShapedArray.buffer // user: %38
strong_release %37 : $TensorBuffer<Int32> // id: %38
%39 = struct_extract %30 : $ShapedArray<Int32>, #ShapedArray.shape // user: %40
release_value %39 : $Array<Int> // id: %40
dealloc_stack %33 : $*ShapedArray<Int32> // id: %41
strong_release %11 : $TensorHandle<Int32> // id: %42
%43 = integer_literal $Builtin.Int64, 0 // users: %168, %208, %142, %44
%44 = struct $Int (%43 : $Builtin.Int64) // user: %50
// function_ref specialized Array.subscript.getter
%45 = function_ref @$SSayxSicigs5Int32V_Tg5 : $@convention(method) (Int, @guaranteed Array<Int32>) -> Int32 // user: %50
%46 = struct_extract %36 : $Array<Int32>, #Array._buffer // user: %47
%47 = struct_extract %46 : $_ArrayBuffer<Int32>, #_ArrayBuffer._storage // user: %48
%48 = struct_extract %47 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore>, #_BridgeStorage.rawValue // user: %49
strong_retain %48 : $Builtin.BridgeObject // id: %49
%50 = apply %45(%44, %36) : $@convention(method) (Int, @guaranteed Array<Int32>) -> Int32 // user: %53
release_value %36 : $Array<Int32> // id: %51
release_value %36 : $Array<Int32> // id: %52
%53 = struct_extract %50 : $Int32, #Int32._value // user: %54
%54 = builtin "sitofp_Int32_FPIEEE32"(%53 : $Builtin.Int32) : $Builtin.FPIEEE32 // users: %157, %155, %152, %143
%55 = struct $Int (%4 : $Builtin.Int64) // user: %60
%56 = alloc_ref [tail_elems $Any * %3 : $Builtin.Word] $_ContiguousArrayStorage<Any> // users: %140, %64, %57
%57 = upcast %56 : $_ContiguousArrayStorage<Any> to $_ContiguousArrayStorageBase // users: %68, %62
%58 = integer_literal $Builtin.Int64, 2 // user: %59
%59 = struct $UInt (%58 : $Builtin.Int64) // user: %60
%60 = struct $_SwiftArrayBodyStorage (%55 : $Int, %59 : $UInt) // user: %61
%61 = struct $_ArrayBody (%60 : $_SwiftArrayBodyStorage) // user: %63
%62 = ref_element_addr %57 : $_ContiguousArrayStorageBase, #_ContiguousArrayStorageBase.countAndCapacity // user: %63
store %61 to %62 : $*_ArrayBody // id: %63
%64 = unchecked_ref_cast %56 : $_ContiguousArrayStorage<Any> to $Builtin.BridgeObject // user: %65
%65 = struct $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore> (%64 : $Builtin.BridgeObject) // user: %66
%66 = struct $_ArrayBuffer<Any> (%65 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore>) // user: %67
%67 = struct $Array<Any> (%66 : $_ArrayBuffer<Any>) // user: %137
%68 = ref_tail_addr %57 : $_ContiguousArrayStorageBase, $Any // user: %69
%69 = init_existential_addr %68 : $*Any, $String // user: %131
%70 = integer_literal $Builtin.Word, 3 // user: %73
%71 = integer_literal $Builtin.Int64, 3 // user: %72
%72 = struct $Int (%71 : $Builtin.Int64) // user: %77
%73 = alloc_ref [tail_elems $String * %70 : $Builtin.Word] $_ContiguousArrayStorage<String> // users: %81, %74
%74 = upcast %73 : $_ContiguousArrayStorage<String> to $_ContiguousArrayStorageBase // users: %85, %79
%75 = integer_literal $Builtin.Int64, 6 // user: %76
%76 = struct $UInt (%75 : $Builtin.Int64) // user: %77
%77 = struct $_SwiftArrayBodyStorage (%72 : $Int, %76 : $UInt) // user: %78
%78 = struct $_ArrayBody (%77 : $_SwiftArrayBodyStorage) // user: %80
%79 = ref_element_addr %74 : $_ContiguousArrayStorageBase, #_ContiguousArrayStorageBase.countAndCapacity // user: %80
store %78 to %79 : $*_ArrayBody // id: %80
%81 = unchecked_ref_cast %73 : $_ContiguousArrayStorage<String> to $Builtin.BridgeObject // user: %82
%82 = struct $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore> (%81 : $Builtin.BridgeObject) // user: %83
%83 = struct $_ArrayBuffer<String> (%82 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore>) // user: %84
%84 = struct $Array<String> (%83 : $_ArrayBuffer<String>) // user: %130
%85 = ref_tail_addr %74 : $_ContiguousArrayStorageBase, $String // users: %105, %112, %104
%86 = string_literal utf8 "Begin training for " // user: %89
%87 = integer_literal $Builtin.Int1, -1 // users: %177, %187, %197, %204, %236, %240, %156, %153, %150
%88 = integer_literal $Builtin.Int64, 19 // user: %96
%89 = builtin "ptrtoint_Word"(%86 : $Builtin.RawPointer) : $Builtin.Word // user: %90
%90 = builtin "zextOrBitCast_Word_Int64"(%89 : $Builtin.Word) : $Builtin.Int64 // user: %92
%91 = integer_literal $Builtin.Int64, -9223372036854775808 // users: %117, %92
%92 = builtin "stringObjectOr_Int64"(%90 : $Builtin.Int64, %91 : $Builtin.Int64) : $Builtin.Int64 // user: %93
%93 = struct $UInt (%92 : $Builtin.Int64) // user: %94
%94 = value_to_bridge_object %93 : $UInt // user: %95
%95 = struct $_StringObject (%94 : $Builtin.BridgeObject) // user: %97
%96 = struct $UInt (%88 : $Builtin.Int64) // user: %97
%97 = struct $_StringGuts (%95 : $_StringObject, %96 : $UInt) // user: %98
%98 = struct $String (%97 : $_StringGuts) // user: %100
%99 = alloc_stack $String // users: %103, %102, %100
store %98 to %99 : $*String // id: %100
// function_ref _toStringReadOnlyStreamable<A>(_:)
%101 = function_ref @$Ss27_toStringReadOnlyStreamableySSxs010TextOutputE0RzlF : $@convention(thin) <τ_0_0 where τ_0_0 : TextOutputStreamable> (@in_guaranteed τ_0_0) -> @owned String // users: %126, %102
%102 = apply %101<String>(%99) : $@convention(thin) <τ_0_0 where τ_0_0 : TextOutputStreamable> (@in_guaranteed τ_0_0) -> @owned String // user: %104
dealloc_stack %99 : $*String // id: %103
store %102 to %85 : $*String // id: %104
%105 = index_addr %85 : $*String, %3 : $Builtin.Word // user: %111
%106 = alloc_stack $Int // users: %110, %109, %107
store %0 to %106 : $*Int // id: %107
// function_ref _toStringReadOnlyPrintable<A>(_:)
%108 = function_ref @$Ss26_toStringReadOnlyPrintableySSxs06CustomB11ConvertibleRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in_guaranteed τ_0_0) -> @owned String // user: %109
%109 = apply %108<Int>(%106) : $@convention(thin) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in_guaranteed τ_0_0) -> @owned String // user: %111
dealloc_stack %106 : $*Int // id: %110
store %109 to %105 : $*String // id: %111
%112 = index_addr %85 : $*String, %2 : $Builtin.Word // user: %128
%113 = string_literal utf8 " iterations." // user: %115
%114 = integer_literal $Builtin.Int64, 12 // user: %121
%115 = builtin "ptrtoint_Word"(%113 : $Builtin.RawPointer) : $Builtin.Word // user: %116
%116 = builtin "zextOrBitCast_Word_Int64"(%115 : $Builtin.Word) : $Builtin.Int64 // user: %117
%117 = builtin "stringObjectOr_Int64"(%116 : $Builtin.Int64, %91 : $Builtin.Int64) : $Builtin.Int64 // user: %118
%118 = struct $UInt (%117 : $Builtin.Int64) // user: %119
%119 = value_to_bridge_object %118 : $UInt // user: %120
%120 = struct $_StringObject (%119 : $Builtin.BridgeObject) // user: %122
%121 = struct $UInt (%114 : $Builtin.Int64) // user: %122
%122 = struct $_StringGuts (%120 : $_StringObject, %121 : $UInt) // user: %123
%123 = struct $String (%122 : $_StringGuts) // user: %125
%124 = alloc_stack $String // users: %127, %126, %125
store %123 to %124 : $*String // id: %125
%126 = apply %101<String>(%124) : $@convention(thin) <τ_0_0 where τ_0_0 : TextOutputStreamable> (@in_guaranteed τ_0_0) -> @owned String // user: %128
dealloc_stack %124 : $*String // id: %127
store %126 to %112 : $*String // id: %128
// function_ref specialized String.init(stringInterpolation:)
%129 = function_ref @$SSS19stringInterpolationS2Sd_tcfCTf4nd_n : $@convention(thin) (@owned Array<String>) -> @owned String // user: %130
%130 = apply %129(%84) : $@convention(thin) (@owned Array<String>) -> @owned String // user: %131
store %130 to %69 : $*String // id: %131
// function_ref default argument 1 of print(_:separator:terminator:)
%132 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String // user: %133
%133 = apply %132() : $@convention(thin) () -> @owned String // users: %139, %137
// function_ref default argument 2 of print(_:separator:terminator:)
%134 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String // user: %135
%135 = apply %134() : $@convention(thin) () -> @owned String // users: %138, %137
// function_ref print(_:separator:terminator:)
%136 = function_ref @$Ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () // user: %137
%137 = apply %136(%67, %133, %135) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> ()
release_value %135 : $String // id: %138
release_value %133 : $String // id: %139
strong_release %56 : $_ContiguousArrayStorage<Any> // id: %140
%141 = struct_extract %0 : $Int, #Int._value // users: %182, %142
%142 = builtin "cmp_slt_Int64"(%141 : $Builtin.Int64, %43 : $Builtin.Int64) : $Builtin.Int1 // user: %162
%143 = builtin "bitcast_FPIEEE32_Int32"(%54 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %145
%144 = integer_literal $Builtin.Int32, 23 // user: %145
%145 = builtin "lshr_Int32"(%143 : $Builtin.Int32, %144 : $Builtin.Int32) : $Builtin.Int32 // user: %146
%146 = builtin "zextOrBitCast_Int32_Int64"(%145 : $Builtin.Int32) : $Builtin.Int64 // user: %148
%147 = integer_literal $Builtin.Int64, 255 // users: %149, %148
%148 = builtin "and_Int64"(%146 : $Builtin.Int64, %147 : $Builtin.Int64) : $Builtin.Int64 // user: %149
%149 = builtin "cmp_ult_Int64"(%148 : $Builtin.Int64, %147 : $Builtin.Int64) : $Builtin.Int1 // user: %150
%150 = builtin "xor_Int1"(%149 : $Builtin.Int1, %87 : $Builtin.Int1) : $Builtin.Int1 // user: %162
%151 = float_literal $Builtin.FPIEEE32, 0xCF000001 // -2.1474839E+9 // user: %152
%152 = builtin "fcmp_olt_FPIEEE32"(%151 : $Builtin.FPIEEE32, %54 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %153
%153 = builtin "xor_Int1"(%152 : $Builtin.Int1, %87 : $Builtin.Int1) : $Builtin.Int1 // user: %163
%154 = float_literal $Builtin.FPIEEE32, 0x4F000000 // 2.14748365E+9 // user: %155
%155 = builtin "fcmp_olt_FPIEEE32"(%54 : $Builtin.FPIEEE32, %154 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %156
%156 = builtin "xor_Int1"(%155 : $Builtin.Int1, %87 : $Builtin.Int1) : $Builtin.Int1 // user: %164
%157 = builtin "fptosi_FPIEEE32_Int32"(%54 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %159
%158 = integer_literal $Builtin.Int32, 25 // user: %159
%159 = builtin "sdiv_Int32"(%157 : $Builtin.Int32, %158 : $Builtin.Int32) : $Builtin.Int32 // users: %167, %186, %219, %161
%160 = integer_literal $Builtin.Int32, 0 // users: %167, %176, %192, %228, %185, %161
%161 = builtin "cmp_slt_Int32"(%159 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // user: %165
%162 = builtin "or_Int1"(%142 : $Builtin.Int1, %150 : $Builtin.Int1) : $Builtin.Int1 // user: %163
%163 = builtin "or_Int1"(%162 : $Builtin.Int1, %153 : $Builtin.Int1) : $Builtin.Int1 // user: %164
%164 = builtin "or_Int1"(%163 : $Builtin.Int1, %156 : $Builtin.Int1) : $Builtin.Int1 // user: %165
%165 = builtin "or_Int1"(%164 : $Builtin.Int1, %161 : $Builtin.Int1) : $Builtin.Int1 // user: %166
cond_fail %165 : $Builtin.Int1 // id: %166
%167 = builtin "cmp_eq_Int32"(%159 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // user: %173
br bb2(%43 : $Builtin.Int64) // id: %168
bb1: // Preds: bb6
strong_release %8 : $TensorHandle<Float> // id: %169
%170 = tuple () // user: %171
return %170 : $() // id: %171
// %172 // users: %182, %177
bb2(%172 : $Builtin.Int64): // Preds: bb0 bb5
cond_br %167, bb3, bb4 // id: %173
bb3: // Preds: bb2
br bb6 // id: %174
bb4: // Preds: bb2
%175 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %217
br bb7(%160 : $Builtin.Int32) // id: %176
bb5: // Preds: bb6
%177 = builtin "sadd_with_overflow_Int64"(%172 : $Builtin.Int64, %4 : $Builtin.Int64, %87 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1) // users: %179, %178
%178 = tuple_extract %177 : $(Builtin.Int64, Builtin.Int1), 0 // user: %181
%179 = tuple_extract %177 : $(Builtin.Int64, Builtin.Int1), 1 // user: %180
cond_fail %179 : $Builtin.Int1 // id: %180
br bb2(%178 : $Builtin.Int64) // id: %181
bb6: // Preds: bb13 bb3
%182 = builtin "cmp_eq_Int64"(%172 : $Builtin.Int64, %141 : $Builtin.Int64) : $Builtin.Int1 // user: %183
cond_br %182, bb1, bb5 // id: %183
// %184 // users: %240, %236, %203, %192, %186, %185
bb7(%184 : $Builtin.Int32): // Preds: bb14 bb4
%185 = builtin "cmp_slt_Int32"(%184 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // users: %188, %190
%186 = builtin "cmp_slt_Int32"(%184 : $Builtin.Int32, %159 : $Builtin.Int32) : $Builtin.Int1 // user: %187
%187 = builtin "xor_Int1"(%186 : $Builtin.Int1, %87 : $Builtin.Int1) : $Builtin.Int1 // user: %188
%188 = builtin "or_Int1"(%185 : $Builtin.Int1, %187 : $Builtin.Int1) : $Builtin.Int1 // user: %189
cond_fail %188 : $Builtin.Int1 // id: %189
cond_br %185, bb8, bb22 // id: %190
bb8: // Preds: bb7
%191 = integer_literal $Builtin.Int1, 0 // users: %195, %192
%192 = builtin "usub_with_overflow_Int32"(%160 : $Builtin.Int32, %184 : $Builtin.Int32, %191 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // user: %193
%193 = tuple_extract %192 : $(Builtin.Int32, Builtin.Int1), 0 // user: %195
%194 = integer_literal $Builtin.Int32, 1 // users: %236, %201, %197, %195
%195 = builtin "usub_with_overflow_Int32"(%193 : $Builtin.Int32, %194 : $Builtin.Int32, %191 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // user: %196
%196 = tuple_extract %195 : $(Builtin.Int32, Builtin.Int1), 0 // user: %197
%197 = builtin "uadd_with_overflow_Int32"(%196 : $Builtin.Int32, %194 : $Builtin.Int32, %87 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // users: %199, %198
%198 = tuple_extract %197 : $(Builtin.Int32, Builtin.Int1), 0 // user: %201
%199 = tuple_extract %197 : $(Builtin.Int32, Builtin.Int1), 1 // user: %200
cond_fail %199 : $Builtin.Int1 // id: %200
%201 = builtin "cmp_ult_Int32"(%198 : $Builtin.Int32, %194 : $Builtin.Int32) : $Builtin.Int1 // user: %202
cond_br %201, bb9, bb21 // id: %202
bb9: // Preds: bb8
%203 = builtin "sextOrBitCast_Int32_Int64"(%184 : $Builtin.Int32) : $Builtin.Int64 // user: %204
%204 = builtin "sadd_with_overflow_Int64"(%203 : $Builtin.Int64, %4 : $Builtin.Int64, %87 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1) // users: %206, %205
%205 = tuple_extract %204 : $(Builtin.Int64, Builtin.Int1), 0 // users: %233, %225, %223, %214, %211, %208
%206 = tuple_extract %204 : $(Builtin.Int64, Builtin.Int1), 1 // user: %207
cond_fail %206 : $Builtin.Int1 // id: %207
%208 = builtin "cmp_slt_Int64"(%205 : $Builtin.Int64, %43 : $Builtin.Int64) : $Builtin.Int1 // user: %209
cond_br %208, bb10, bb15 // id: %209
bb10: // Preds: bb9
%210 = integer_literal $Builtin.Int64, -2147483648 // user: %211
%211 = builtin "cmp_slt_Int64"(%205 : $Builtin.Int64, %210 : $Builtin.Int64) : $Builtin.Int1 // user: %212
cond_fail %211 : $Builtin.Int1 // id: %212
br bb11 // id: %213
bb11: // Preds: bb18 bb20 bb10
%214 = builtin "truncOrBitCast_Int64_Int32"(%205 : $Builtin.Int64) : $Builtin.Int32 // user: %215
br bb12(%214 : $Builtin.Int32) // id: %215
// %216 // users: %222, %219
bb12(%216 : $Builtin.Int32): // Preds: bb22 bb21 bb11
%217 = graph_op "tfc.scalarToTensor,s"(%175 : $Builtin.FPIEEE64) {__device: "/device:CPU:0"} : $TensorHandle<Double> // user: %218
strong_release %217 : $TensorHandle<Double> // id: %218
%219 = builtin "cmp_eq_Int32"(%216 : $Builtin.Int32, %159 : $Builtin.Int32) : $Builtin.Int1 // user: %220
cond_br %219, bb13, bb14 // id: %220
bb13: // Preds: bb12
br bb6 // id: %221
bb14: // Preds: bb12
br bb7(%216 : $Builtin.Int32) // id: %222
bb15: // Preds: bb9
%223 = builtin "truncOrBitCast_Int64_Int32"(%205 : $Builtin.Int64) : $Builtin.Int32 // users: %224, %228
%224 = builtin "sextOrBitCast_Int32_Int64"(%223 : $Builtin.Int32) : $Builtin.Int64 // user: %225
%225 = builtin "cmp_eq_Int64"(%224 : $Builtin.Int64, %205 : $Builtin.Int64) : $Builtin.Int1 // user: %226
cond_br %225, bb17, bb16 // id: %226
bb16: // Preds: bb15
br bb20 // id: %227
bb17: // Preds: bb15
%228 = builtin "cmp_slt_Int32"(%223 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // user: %229
cond_br %228, bb19, bb18 // id: %229
bb18: // Preds: bb17
br bb11 // id: %230
bb19: // Preds: bb17
br bb20 // id: %231
bb20: // Preds: bb19 bb16
%232 = integer_literal $Builtin.Int64, 2147483647 // user: %233
%233 = builtin "cmp_slt_Int64"(%232 : $Builtin.Int64, %205 : $Builtin.Int64) : $Builtin.Int1 // user: %234
cond_fail %233 : $Builtin.Int1 // id: %234
br bb11 // id: %235
bb21: // Preds: bb8
%236 = builtin "sadd_with_overflow_Int32"(%184 : $Builtin.Int32, %194 : $Builtin.Int32, %87 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // user: %237
%237 = tuple_extract %236 : $(Builtin.Int32, Builtin.Int1), 0 // user: %238
br bb12(%237 : $Builtin.Int32) // id: %238
bb22: // Preds: bb7
%239 = integer_literal $Builtin.Int32, 1 // user: %240
%240 = builtin "sadd_with_overflow_Int32"(%184 : $Builtin.Int32, %239 : $Builtin.Int32, %87 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // users: %242, %241
%241 = tuple_extract %240 : $(Builtin.Int32, Builtin.Int1), 0 // user: %244
%242 = tuple_extract %240 : $(Builtin.Int32, Builtin.Int1), 1 // user: %243
cond_fail %242 : $Builtin.Int1 // id: %243
br bb12(%241 : $Builtin.Int32) // id: %244
} // end sil function '$S4main5train14iterationCountySi_tF'
---- END OF INPUT FUNCTION ----------
artificial-loc.swift:3:12: warning: 'iterationCount' implicitly copied to the accelerator, use .toAccelerator() to make transfer explicit
func train(iterationCount: Int) {
^~~~~~~~~~~~~~~~~~~
artificial-loc.swift:9:9: note: value used here
for _ in 0...iterationCount {
^~
IMPLICIT COPY TO ACCEL OF: %159 = builtin "sdiv_Int32"(%157 : $Builtin.Int32, %158 : $Builtin.Int32) : $Builtin.Int32 // users: %167, %186, %219, %161
IMPLICIT COPY TO ACCEL BY: %167 = builtin "cmp_eq_Int32"(%159 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // user: %173
artificial-loc.swift:10:33: warning: method result implicitly copied to the accelerator, use .toAccelerator() to make transfer explicit
let bound = Int32(batchSize)/25
~~~~~~~~~~~~~~~~^~~
artificial-loc.swift:3:33: note: value used here
func train(iterationCount: Int) {
^
IMPLICIT COPY TO ACCEL OF: %201 = builtin "cmp_ult_Int32"(%198 : $Builtin.Int32, %194 : $Builtin.Int32) : $Builtin.Int1 // user: %202
IMPLICIT COPY TO ACCEL BY: cond_br %201, bb9, bb21 // id: %202
artificial-loc.swift:11:11: warning: method result implicitly copied to the accelerator, use .toAccelerator() to make transfer explicit
for i in 0..<bound {
^~
---- ANALYSIS STATE FOR FUNCTION $S4main5train14iterationCountySi_tF ----------
Tensor start point: %6 = integer_literal $Builtin.Int64, 1 // users: %177, %204, %57, %7
Tensor end point: strong_release %10 : $TensorHandle<Float> // id: %169
SIL with markings:
bb0:
%0 = argument of bb0 : $Int // users: %109, %4, %1
debug_value %0 : $Int, let, name "iterationCount", argno 1 // id: %1
%2 = integer_literal $Builtin.Word, 2 // user: %114
%3 = integer_literal $Builtin.Word, 1 // users: %107, %58
[Arg] %4 = struct_extract %0 : $Int, #Int._value // users: %182, %143
[Copy] %5 = integer_literal $Builtin.Int32, 0 // users: %167, %176, %192, %228, %185, %161
[Copy] %6 = integer_literal $Builtin.Int64, 1 // users: %177, %204, %57, %7
[Move] %7 = builtin "sitofp_Int64_FPIEEE32"(%6 : $Builtin.Int64) : $Builtin.FPIEEE32 // user: %9
[Move] %8 = graph_op "Const"() {dtype: $Int32, value$tensor: [$Int32: (i32 1000), (i32 784)], value$shape: [$Int32: i32 2], __device: "/device:CPU:0"} : $TensorHandle<Int32> // users: %12, %10
[Move] %9 = graph_op "tfc.scalarToTensor,s"(%7 : $Builtin.FPIEEE32) {__device: "/device:CPU:0"} : $TensorHandle<Float> // users: %11, %10
[Move] %10 = graph_op "Fill,i,i"(%8 : $TensorHandle<Int32>, %9 : $TensorHandle<Float>) {T: $Float, index_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Float> // users: %169, %13
strong_release %9 : $TensorHandle<Float> // id: %11
strong_release %8 : $TensorHandle<Int32> // id: %12
[Move] %13 = graph_op "Shape,i"(%10 : $TensorHandle<Float>) {T: $Float, out_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Int32> // users: %29, %44, %27, %28
// function_ref implicit closure #1 in Tensor.array.getter
%14 = function_ref @$S10TensorFlow0A0V5arrayAA11ShapedArrayVyxGvgSSyXKfu_ : $@convention(thin) () -> @owned String // user: %15
%15 = convert_function %14 : $@convention(thin) () -> @owned String to $@convention(thin) @noescape () -> @owned String // user: %16
%16 = thin_to_thick_function %15 : $@convention(thin) @noescape () -> @owned String to $@noescape @callee_guaranteed () -> @owned String // user: %25
%17 = string_literal utf8 "/Users/danielzheng/swift-dan/swift/stdlib/public/TensorFlow/Tensor.swift" // user: %19
%18 = integer_literal $Builtin.Word, 72 // user: %21
%19 = builtin "ptrtoint_Word"(%17 : $Builtin.RawPointer) : $Builtin.Word // user: %21
%20 = integer_literal $Builtin.Int8, 2 // user: %21
%21 = struct $StaticString (%19 : $Builtin.Word, %18 : $Builtin.Word, %20 : $Builtin.Int8) // user: %25
%22 = integer_literal $Builtin.Int64, 863 // user: %23
%23 = struct $UInt (%22 : $Builtin.Int64) // user: %25
// function_ref debugLog(_:file:line:)
%24 = function_ref @$S10TensorFlow8debugLog_4file4lineySSyXK_s12StaticStringVSutF : $@convention(thin) (@noescape @callee_guaranteed () -> @owned String, StaticString, UInt) -> () // user: %25
%25 = apply %24(%16, %21, %23) : $@convention(thin) (@noescape @callee_guaranteed () -> @owned String, StaticString, UInt) -> ()
// function_ref __tf_receive
%26 = function_ref @__tf_receive : $@convention(thin) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned TensorHandle<τ_0_0> // user: %28
strong_retain %13 : $TensorHandle<Int32> // id: %27
%28 = apply %26<Int32>(%13) : $@convention(thin) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned TensorHandle<τ_0_0> // users: %33, %34, %31, %32
strong_release %13 : $TensorHandle<Int32> // id: %29
// function_ref TensorHandle.makeHostCopy()
%30 = function_ref @$S10TensorFlow0A6HandleC12makeHostCopyAA11ShapedArrayVyxGyF : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned ShapedArray<τ_0_0> // user: %32
strong_retain %28 : $TensorHandle<Int32> // id: %31
%32 = apply %30<Int32>(%28) : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@guaranteed TensorHandle<τ_0_0>) -> @owned ShapedArray<τ_0_0> // users: %41, %39, %36
strong_release %28 : $TensorHandle<Int32> // id: %33
strong_release %28 : $TensorHandle<Int32> // id: %34
%35 = alloc_stack $ShapedArray<Int32> // users: %43, %38, %36
store %32 to %35 : $*ShapedArray<Int32> // id: %36
// function_ref _ShapedArrayProtocol.scalars.getter
%37 = function_ref @$S10TensorFlow20_ShapedArrayProtocolPAAE7scalarsSay6ScalarQzGvg : $@convention(method) <τ_0_0 where τ_0_0 : _ShapedArrayProtocol> (@in_guaranteed τ_0_0) -> @owned Array<τ_0_0.Scalar> // user: %38
%38 = apply %37<ShapedArray<Int32>>(%35) : $@convention(method) <τ_0_0 where τ_0_0 : _ShapedArrayProtocol> (@in_guaranteed τ_0_0) -> @owned Array<τ_0_0.Scalar> // users: %53, %54, %48, %52
%39 = struct_extract %32 : $ShapedArray<Int32>, #ShapedArray.buffer // user: %40
strong_release %39 : $TensorBuffer<Int32> // id: %40
%41 = struct_extract %32 : $ShapedArray<Int32>, #ShapedArray.shape // user: %42
release_value %41 : $Array<Int> // id: %42
dealloc_stack %35 : $*ShapedArray<Int32> // id: %43
strong_release %13 : $TensorHandle<Int32> // id: %44
[Copy] %45 = integer_literal $Builtin.Int64, 0 // users: %168, %208, %143, %46
%46 = struct $Int (%45 : $Builtin.Int64) // user: %52
// function_ref specialized Array.subscript.getter
%47 = function_ref @$SSayxSicigs5Int32V_Tg5 : $@convention(method) (Int, @guaranteed Array<Int32>) -> Int32 // user: %52
%48 = struct_extract %38 : $Array<Int32>, #Array._buffer // user: %49
%49 = struct_extract %48 : $_ArrayBuffer<Int32>, #_ArrayBuffer._storage // user: %50
%50 = struct_extract %49 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore>, #_BridgeStorage.rawValue // user: %51
strong_retain %50 : $Builtin.BridgeObject // id: %51
%52 = apply %47(%46, %38) : $@convention(method) (Int, @guaranteed Array<Int32>) -> Int32 // user: %55
release_value %38 : $Array<Int32> // id: %53
release_value %38 : $Array<Int32> // id: %54
%55 = struct_extract %52 : $Int32, #Int32._value // user: %56
%56 = builtin "sitofp_Int32_FPIEEE32"(%55 : $Builtin.Int32) : $Builtin.FPIEEE32 // users: %158, %156, %153, %144
%57 = struct $Int (%6 : $Builtin.Int64) // user: %62
%58 = alloc_ref [tail_elems $Any * %3 : $Builtin.Word] $_ContiguousArrayStorage<Any> // users: %142, %66, %59
%59 = upcast %58 : $_ContiguousArrayStorage<Any> to $_ContiguousArrayStorageBase // users: %70, %64
%60 = integer_literal $Builtin.Int64, 2 // user: %61
%61 = struct $UInt (%60 : $Builtin.Int64) // user: %62
%62 = struct $_SwiftArrayBodyStorage (%57 : $Int, %61 : $UInt) // user: %63
%63 = struct $_ArrayBody (%62 : $_SwiftArrayBodyStorage) // user: %65
%64 = ref_element_addr %59 : $_ContiguousArrayStorageBase, #_ContiguousArrayStorageBase.countAndCapacity // user: %65
store %63 to %64 : $*_ArrayBody // id: %65
%66 = unchecked_ref_cast %58 : $_ContiguousArrayStorage<Any> to $Builtin.BridgeObject // user: %67
%67 = struct $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore> (%66 : $Builtin.BridgeObject) // user: %68
%68 = struct $_ArrayBuffer<Any> (%67 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore>) // user: %69
%69 = struct $Array<Any> (%68 : $_ArrayBuffer<Any>) // user: %139
%70 = ref_tail_addr %59 : $_ContiguousArrayStorageBase, $Any // user: %71
%71 = init_existential_addr %70 : $*Any, $String // user: %133
%72 = integer_literal $Builtin.Word, 3 // user: %75
%73 = integer_literal $Builtin.Int64, 3 // user: %74
%74 = struct $Int (%73 : $Builtin.Int64) // user: %79
%75 = alloc_ref [tail_elems $String * %72 : $Builtin.Word] $_ContiguousArrayStorage<String> // users: %83, %76
%76 = upcast %75 : $_ContiguousArrayStorage<String> to $_ContiguousArrayStorageBase // users: %87, %81
%77 = integer_literal $Builtin.Int64, 6 // user: %78
%78 = struct $UInt (%77 : $Builtin.Int64) // user: %79
%79 = struct $_SwiftArrayBodyStorage (%74 : $Int, %78 : $UInt) // user: %80
%80 = struct $_ArrayBody (%79 : $_SwiftArrayBodyStorage) // user: %82
%81 = ref_element_addr %76 : $_ContiguousArrayStorageBase, #_ContiguousArrayStorageBase.countAndCapacity // user: %82
store %80 to %81 : $*_ArrayBody // id: %82
%83 = unchecked_ref_cast %75 : $_ContiguousArrayStorage<String> to $Builtin.BridgeObject // user: %84
%84 = struct $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore> (%83 : $Builtin.BridgeObject) // user: %85
%85 = struct $_ArrayBuffer<String> (%84 : $_BridgeStorage<_ContiguousArrayStorageBase, _NSArrayCore>) // user: %86
%86 = struct $Array<String> (%85 : $_ArrayBuffer<String>) // user: %132
%87 = ref_tail_addr %76 : $_ContiguousArrayStorageBase, $String // users: %107, %114, %106
%88 = string_literal utf8 "Begin training for " // user: %91
%89 = integer_literal $Builtin.Int1, -1 // users: %177, %187, %197, %204, %236, %240, %157, %154, %151
%90 = integer_literal $Builtin.Int64, 19 // user: %98
%91 = builtin "ptrtoint_Word"(%88 : $Builtin.RawPointer) : $Builtin.Word // user: %92
%92 = builtin "zextOrBitCast_Word_Int64"(%91 : $Builtin.Word) : $Builtin.Int64 // user: %94
%93 = integer_literal $Builtin.Int64, -9223372036854775808 // users: %119, %94
%94 = builtin "stringObjectOr_Int64"(%92 : $Builtin.Int64, %93 : $Builtin.Int64) : $Builtin.Int64 // user: %95
%95 = struct $UInt (%94 : $Builtin.Int64) // user: %96
%96 = value_to_bridge_object %95 : $UInt // user: %97
%97 = struct $_StringObject (%96 : $Builtin.BridgeObject) // user: %99
%98 = struct $UInt (%90 : $Builtin.Int64) // user: %99
%99 = struct $_StringGuts (%97 : $_StringObject, %98 : $UInt) // user: %100
%100 = struct $String (%99 : $_StringGuts) // user: %102
%101 = alloc_stack $String // users: %105, %104, %102
store %100 to %101 : $*String // id: %102
// function_ref _toStringReadOnlyStreamable<A>(_:)
%103 = function_ref @$Ss27_toStringReadOnlyStreamableySSxs010TextOutputE0RzlF : $@convention(thin) <τ_0_0 where τ_0_0 : TextOutputStreamable> (@in_guaranteed τ_0_0) -> @owned String // users: %128, %104
%104 = apply %103<String>(%101) : $@convention(thin) <τ_0_0 where τ_0_0 : TextOutputStreamable> (@in_guaranteed τ_0_0) -> @owned String // user: %106
dealloc_stack %101 : $*String // id: %105
store %104 to %87 : $*String // id: %106
%107 = index_addr %87 : $*String, %3 : $Builtin.Word // user: %113
%108 = alloc_stack $Int // users: %112, %111, %109
store %0 to %108 : $*Int // id: %109
// function_ref _toStringReadOnlyPrintable<A>(_:)
%110 = function_ref @$Ss26_toStringReadOnlyPrintableySSxs06CustomB11ConvertibleRzlF : $@convention(thin) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in_guaranteed τ_0_0) -> @owned String // user: %111
%111 = apply %110<Int>(%108) : $@convention(thin) <τ_0_0 where τ_0_0 : CustomStringConvertible> (@in_guaranteed τ_0_0) -> @owned String // user: %113
dealloc_stack %108 : $*Int // id: %112
store %111 to %107 : $*String // id: %113
%114 = index_addr %87 : $*String, %2 : $Builtin.Word // user: %130
%115 = string_literal utf8 " iterations." // user: %117
%116 = integer_literal $Builtin.Int64, 12 // user: %123
%117 = builtin "ptrtoint_Word"(%115 : $Builtin.RawPointer) : $Builtin.Word // user: %118
%118 = builtin "zextOrBitCast_Word_Int64"(%117 : $Builtin.Word) : $Builtin.Int64 // user: %119
%119 = builtin "stringObjectOr_Int64"(%118 : $Builtin.Int64, %93 : $Builtin.Int64) : $Builtin.Int64 // user: %120
%120 = struct $UInt (%119 : $Builtin.Int64) // user: %121
%121 = value_to_bridge_object %120 : $UInt // user: %122
%122 = struct $_StringObject (%121 : $Builtin.BridgeObject) // user: %124
%123 = struct $UInt (%116 : $Builtin.Int64) // user: %124
%124 = struct $_StringGuts (%122 : $_StringObject, %123 : $UInt) // user: %125
%125 = struct $String (%124 : $_StringGuts) // user: %127
%126 = alloc_stack $String // users: %129, %128, %127
store %125 to %126 : $*String // id: %127
%128 = apply %103<String>(%126) : $@convention(thin) <τ_0_0 where τ_0_0 : TextOutputStreamable> (@in_guaranteed τ_0_0) -> @owned String // user: %130
dealloc_stack %126 : $*String // id: %129
store %128 to %114 : $*String // id: %130
// function_ref specialized String.init(stringInterpolation:)
%131 = function_ref @$SSS19stringInterpolationS2Sd_tcfCTf4nd_n : $@convention(thin) (@owned Array<String>) -> @owned String // user: %132
%132 = apply %131(%86) : $@convention(thin) (@owned Array<String>) -> @owned String // user: %133
store %132 to %71 : $*String // id: %133
// function_ref default argument 1 of print(_:separator:terminator:)
%134 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String // user: %135
%135 = apply %134() : $@convention(thin) () -> @owned String // users: %141, %139
// function_ref default argument 2 of print(_:separator:terminator:)
%136 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String // user: %137
%137 = apply %136() : $@convention(thin) () -> @owned String // users: %140, %139
// function_ref print(_:separator:terminator:)
%138 = function_ref @$Ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> () // user: %139
%139 = apply %138(%69, %135, %137) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> ()
release_value %137 : $String // id: %140
release_value %135 : $String // id: %141
strong_release %58 : $_ContiguousArrayStorage<Any> // id: %142
%143 = builtin "cmp_slt_Int64"(%4 : $Builtin.Int64, %45 : $Builtin.Int64) : $Builtin.Int1 // user: %162
%144 = builtin "bitcast_FPIEEE32_Int32"(%56 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %146
%145 = integer_literal $Builtin.Int32, 23 // user: %146
%146 = builtin "lshr_Int32"(%144 : $Builtin.Int32, %145 : $Builtin.Int32) : $Builtin.Int32 // user: %147
%147 = builtin "zextOrBitCast_Int32_Int64"(%146 : $Builtin.Int32) : $Builtin.Int64 // user: %149
%148 = integer_literal $Builtin.Int64, 255 // users: %150, %149
%149 = builtin "and_Int64"(%147 : $Builtin.Int64, %148 : $Builtin.Int64) : $Builtin.Int64 // user: %150
%150 = builtin "cmp_ult_Int64"(%149 : $Builtin.Int64, %148 : $Builtin.Int64) : $Builtin.Int1 // user: %151
%151 = builtin "xor_Int1"(%150 : $Builtin.Int1, %89 : $Builtin.Int1) : $Builtin.Int1 // user: %162
%152 = float_literal $Builtin.FPIEEE32, 0xCF000001 // -2.1474839E+9 // user: %153
%153 = builtin "fcmp_olt_FPIEEE32"(%152 : $Builtin.FPIEEE32, %56 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %154
%154 = builtin "xor_Int1"(%153 : $Builtin.Int1, %89 : $Builtin.Int1) : $Builtin.Int1 // user: %163
%155 = float_literal $Builtin.FPIEEE32, 0x4F000000 // 2.14748365E+9 // user: %156
%156 = builtin "fcmp_olt_FPIEEE32"(%56 : $Builtin.FPIEEE32, %155 : $Builtin.FPIEEE32) : $Builtin.Int1 // user: %157
%157 = builtin "xor_Int1"(%156 : $Builtin.Int1, %89 : $Builtin.Int1) : $Builtin.Int1 // user: %164
%158 = builtin "fptosi_FPIEEE32_Int32"(%56 : $Builtin.FPIEEE32) : $Builtin.Int32 // user: %160
%159 = integer_literal $Builtin.Int32, 25 // user: %160
[Send] %160 = builtin "sdiv_Int32"(%158 : $Builtin.Int32, %159 : $Builtin.Int32) : $Builtin.Int32 // users: %167, %186, %219, %161
%161 = builtin "cmp_slt_Int32"(%160 : $Builtin.Int32, %5 : $Builtin.Int32) : $Builtin.Int1 // user: %165
%162 = builtin "or_Int1"(%143 : $Builtin.Int1, %151 : $Builtin.Int1) : $Builtin.Int1 // user: %163
%163 = builtin "or_Int1"(%162 : $Builtin.Int1, %154 : $Builtin.Int1) : $Builtin.Int1 // user: %164
%164 = builtin "or_Int1"(%163 : $Builtin.Int1, %157 : $Builtin.Int1) : $Builtin.Int1 // user: %165
%165 = builtin "or_Int1"(%164 : $Builtin.Int1, %161 : $Builtin.Int1) : $Builtin.Int1 // user: %166
cond_fail %165 : $Builtin.Int1 // id: %166
[Copy] %167 = builtin "cmp_eq_Int32"(%160 : $Builtin.Int32, %5 : $Builtin.Int32) : $Builtin.Int1 // user: %173
[Copy] br bb2(%45 : $Builtin.Int64) // id: %168
bb1:
strong_release %10 : $TensorHandle<Float> // id: %169
%170 = tuple () // user: %171
return %170 : $() // id: %171
bb2:
[Copy] %172 = argument of bb2 : $Builtin.Int64 // users: %182, %177
[Copy] cond_br %167, bb3, bb4 // id: %173
bb3:
br bb6 // id: %174
bb4:
[Move] %175 = float_literal $Builtin.FPIEEE64, 0x3FF0000000000000 // 1 // user: %217
[Copy] br bb7(%5 : $Builtin.Int32) // id: %176
bb5:
[Copy] %177 = builtin "sadd_with_overflow_Int64"(%172 : $Builtin.Int64, %6 : $Builtin.Int64, %89 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1) // users: %179, %178
[Copy] %178 = tuple_extract %177 : $(Builtin.Int64, Builtin.Int1), 0 // user: %181
%179 = tuple_extract %177 : $(Builtin.Int64, Builtin.Int1), 1 // user: %180
cond_fail %179 : $Builtin.Int1 // id: %180
[Copy] br bb2(%178 : $Builtin.Int64) // id: %181
bb6:
[Copy] %182 = builtin "cmp_eq_Int64"(%172 : $Builtin.Int64, %4 : $Builtin.Int64) : $Builtin.Int1 // user: %183
[Copy] cond_br %182, bb1, bb5 // id: %183
bb7:
[Copy] %184 = argument of bb7 : $Builtin.Int32 // users: %240, %236, %203, %192, %186, %185
[Copy] %185 = builtin "cmp_slt_Int32"(%184 : $Builtin.Int32, %5 : $Builtin.Int32) : $Builtin.Int1 // users: %188, %190
%186 = builtin "cmp_slt_Int32"(%184 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // user: %187
%187 = builtin "xor_Int1"(%186 : $Builtin.Int1, %89 : $Builtin.Int1) : $Builtin.Int1 // user: %188
%188 = builtin "or_Int1"(%185 : $Builtin.Int1, %187 : $Builtin.Int1) : $Builtin.Int1 // user: %189
cond_fail %188 : $Builtin.Int1 // id: %189
[Copy] cond_br %185, bb8, bb22 // id: %190
bb8:
%191 = integer_literal $Builtin.Int1, 0 // users: %195, %192
%192 = builtin "usub_with_overflow_Int32"(%5 : $Builtin.Int32, %184 : $Builtin.Int32, %191 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // user: %193
%193 = tuple_extract %192 : $(Builtin.Int32, Builtin.Int1), 0 // user: %195
[Copy] %194 = integer_literal $Builtin.Int32, 1 // users: %236, %201, %197, %195
%195 = builtin "usub_with_overflow_Int32"(%193 : $Builtin.Int32, %194 : $Builtin.Int32, %191 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // user: %196
%196 = tuple_extract %195 : $(Builtin.Int32, Builtin.Int1), 0 // user: %197
%197 = builtin "uadd_with_overflow_Int32"(%196 : $Builtin.Int32, %194 : $Builtin.Int32, %89 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // users: %199, %198
%198 = tuple_extract %197 : $(Builtin.Int32, Builtin.Int1), 0 // user: %201
%199 = tuple_extract %197 : $(Builtin.Int32, Builtin.Int1), 1 // user: %200
cond_fail %199 : $Builtin.Int1 // id: %200
[Send] %201 = builtin "cmp_ult_Int32"(%198 : $Builtin.Int32, %194 : $Builtin.Int32) : $Builtin.Int1 // user: %202
[Copy] cond_br %201, bb9, bb21 // id: %202
bb9:
[Copy] %203 = builtin "sextOrBitCast_Int32_Int64"(%184 : $Builtin.Int32) : $Builtin.Int64 // user: %204
[Copy] %204 = builtin "sadd_with_overflow_Int64"(%203 : $Builtin.Int64, %6 : $Builtin.Int64, %89 : $Builtin.Int1) : $(Builtin.Int64, Builtin.Int1) // users: %206, %205
[Copy] %205 = tuple_extract %204 : $(Builtin.Int64, Builtin.Int1), 0 // users: %233, %225, %223, %214, %211, %208
%206 = tuple_extract %204 : $(Builtin.Int64, Builtin.Int1), 1 // user: %207
cond_fail %206 : $Builtin.Int1 // id: %207
%208 = builtin "cmp_slt_Int64"(%205 : $Builtin.Int64, %45 : $Builtin.Int64) : $Builtin.Int1 // user: %209
cond_br %208, bb10, bb15 // id: %209
bb10:
%210 = integer_literal $Builtin.Int64, -2147483648 // user: %211
%211 = builtin "cmp_slt_Int64"(%205 : $Builtin.Int64, %210 : $Builtin.Int64) : $Builtin.Int1 // user: %212
cond_fail %211 : $Builtin.Int1 // id: %212
br bb11 // id: %213
bb11:
[Copy] %214 = builtin "truncOrBitCast_Int64_Int32"(%205 : $Builtin.Int64) : $Builtin.Int32 // user: %215
[Copy] br bb12(%214 : $Builtin.Int32) // id: %215
bb12:
[Copy] %216 = argument of bb12 : $Builtin.Int32 // users: %222, %219
[Move] %217 = graph_op "tfc.scalarToTensor,s"(%175 : $Builtin.FPIEEE64) {__device: "/device:CPU:0"} : $TensorHandle<Double> // user: %218
strong_release %217 : $TensorHandle<Double> // id: %218
[Copy] %219 = builtin "cmp_eq_Int32"(%216 : $Builtin.Int32, %160 : $Builtin.Int32) : $Builtin.Int1 // user: %220
[Copy] cond_br %219, bb13, bb14 // id: %220
bb13:
br bb6 // id: %221
bb14:
[Copy] br bb7(%216 : $Builtin.Int32) // id: %222
bb15:
%223 = builtin "truncOrBitCast_Int64_Int32"(%205 : $Builtin.Int64) : $Builtin.Int32 // users: %224, %228
%224 = builtin "sextOrBitCast_Int32_Int64"(%223 : $Builtin.Int32) : $Builtin.Int64 // user: %225
%225 = builtin "cmp_eq_Int64"(%224 : $Builtin.Int64, %205 : $Builtin.Int64) : $Builtin.Int1 // user: %226
cond_br %225, bb17, bb16 // id: %226
bb16:
br bb20 // id: %227
bb17:
%228 = builtin "cmp_slt_Int32"(%223 : $Builtin.Int32, %5 : $Builtin.Int32) : $Builtin.Int1 // user: %229
cond_br %228, bb19, bb18 // id: %229
bb18:
br bb11 // id: %230
bb19:
br bb20 // id: %231
bb20:
%232 = integer_literal $Builtin.Int64, 2147483647 // user: %233
%233 = builtin "cmp_slt_Int64"(%232 : $Builtin.Int64, %205 : $Builtin.Int64) : $Builtin.Int1 // user: %234
cond_fail %233 : $Builtin.Int1 // id: %234
br bb11 // id: %235
bb21:
[Copy] %236 = builtin "sadd_with_overflow_Int32"(%184 : $Builtin.Int32, %194 : $Builtin.Int32, %89 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // user: %237
[Copy] %237 = tuple_extract %236 : $(Builtin.Int32, Builtin.Int1), 0 // user: %238
[Copy] br bb12(%237 : $Builtin.Int32) // id: %238
bb22:
[Copy] %239 = integer_literal $Builtin.Int32, 1 // user: %240
[Copy] %240 = builtin "sadd_with_overflow_Int32"(%184 : $Builtin.Int32, %239 : $Builtin.Int32, %89 : $Builtin.Int1) : $(Builtin.Int32, Builtin.Int1) // users: %242, %241
[Copy] %241 = tuple_extract %240 : $(Builtin.Int32, Builtin.Int1), 0 // user: %244
%242 = tuple_extract %240 : $(Builtin.Int32, Builtin.Int1), 1 // user: %243
cond_fail %242 : $Builtin.Int1 // id: %243
[Copy] br bb12(%241 : $Builtin.Int32) // id: %244
---- END OF ANALYSIS STATE FOR FUNCTION ----------
---- PARTITION STATE FOR FUNCTION $S4main5train14iterationCountySi_tF ----------
(Possibly updated) tensor end point: strong_release %10 : $TensorHandle<Float> // id: %169
There are 0 result values:
---- END OF PARTITION STATE FOR FUNCTION ----------
--- TFPartition Accelerator Result: $S4main5train14iterationCountySi_tF.tf
// train(iterationCount:)
sil private @$S4main5train14iterationCountySi_tF.tf : $@callee_owned (TensorHandle<Builtin.Int64>) -> () {
// %0 // user: %20
bb0(%0 : $TensorHandle<Builtin.Int64>):
%1 = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 0, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // users: %24, %17, %11
%2 = graph_op "Const"() {dtype$dtype: $Builtin.Int64, value$tensor: i64 1, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // users: %32, %18, %3
%3 = graph_op "Cast,i"(%2 : $TensorHandle<Builtin.Int64>) {DstT$dtype: $Builtin.FPIEEE32, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.FPIEEE32> // user: %5
%4 = graph_op "Const"() {dtype: $Int32, value$tensor: [$Int32: (i32 1000), (i32 784)], value$shape: [$Int32: i32 2], __device: "/device:CPU:0"} : $TensorHandle<Int32> // user: %6
%5 = unchecked_ref_cast %3 : $TensorHandle<Builtin.FPIEEE32> to $TensorHandle<Float> // user: %6
%6 = graph_op "Fill,i,i"(%4 : $TensorHandle<Int32>, %5 : $TensorHandle<Float>) {T: $Float, index_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Float> // user: %7
%7 = graph_op "Shape,i"(%6 : $TensorHandle<Float>) {T: $Float, out_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Int32> // user: %8
%8 = graph_op "tfc.SendToHost,i"(%7 : $TensorHandle<Int32>) {tensorId: i32 2, __device: "/device:CPU:0"} : $()
%9 = graph_op "Const"() {dtype$dtype: $Builtin.Int64, value$tensor: i64 0, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %12
%10 = graph_op "tfc.RecvFromHost"() {tensorId: i32 0, __device: "/device:CPU:0"} : $TensorHandle<Builtin.Int32> // users: %37, %11
%11 = graph_op "Equal,i,i"(%10 : $TensorHandle<Builtin.Int32>, %1 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %14
br bb1(%9 : $TensorHandle<Builtin.Int64>) // id: %12
// %13 // users: %18, %20
bb1(%13 : $TensorHandle<Builtin.Int64>): // Preds: bb3 bb0
%14 = graph_op "tf_tensor_to_i1"(%11 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %15
cond_br %14, bb4, bb2 // id: %15
bb2: // Preds: bb1
%16 = graph_op "Const"() {dtype$dtype: $Builtin.FPIEEE64, value$tensor: f64 0x3FF0000000000000 /* 1 */, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.FPIEEE64> // user: %36
br bb5(%1 : $TensorHandle<Builtin.Int32>) // id: %17
bb3: // Preds: bb4
%18 = graph_op "Add,i,i"(%13 : $TensorHandle<Builtin.Int64>, %2 : $TensorHandle<Builtin.Int64>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %19
br bb1(%18 : $TensorHandle<Builtin.Int64>) // id: %19
bb4: // Preds: bb8 bb1
%20 = graph_op "Equal,i,i"(%13 : $TensorHandle<Builtin.Int64>, %0 : $TensorHandle<Builtin.Int64>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %21
%21 = graph_op "tf_tensor_to_i1"(%20 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %22
cond_br %21, bb12, bb3 // id: %22
// %23 // users: %44, %41, %31, %24
bb5(%23 : $TensorHandle<Builtin.Int32>): // Preds: bb9 bb2
%24 = graph_op "Less,i,i"(%23 : $TensorHandle<Builtin.Int32>, %1 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %25
%25 = graph_op "tf_tensor_to_i1"(%24 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %26
cond_br %25, bb6, bb11 // id: %26
bb6: // Preds: bb5
%27 = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 1, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %41
%28 = graph_op "tfc.RecvFromHost"() {tensorId: i32 1, __device: "/device:CPU:0"} : $TensorHandle<Builtin.Int1> // user: %29
%29 = graph_op "tf_tensor_to_i1"(%28 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %30
cond_br %29, bb7, bb10 // id: %30
bb7: // Preds: bb6
%31 = graph_op "Cast,i"(%23 : $TensorHandle<Builtin.Int32>) {DstT$dtype: $Builtin.Int64, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %32
%32 = graph_op "Add,i,i"(%31 : $TensorHandle<Builtin.Int64>, %2 : $TensorHandle<Builtin.Int64>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %33
%33 = graph_op "Cast,i"(%32 : $TensorHandle<Builtin.Int64>) {DstT$dtype: $Builtin.Int32, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %34
br bb8(%33 : $TensorHandle<Builtin.Int32>) // id: %34
// %35 // users: %40, %37
bb8(%35 : $TensorHandle<Builtin.Int32>): // Preds: bb11 bb10 bb7
%36 = unchecked_ref_cast %16 : $TensorHandle<Builtin.FPIEEE64> to $TensorHandle<Double>
%37 = graph_op "Equal,i,i"(%35 : $TensorHandle<Builtin.Int32>, %10 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %38
%38 = graph_op "tf_tensor_to_i1"(%37 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %39
cond_br %38, bb4, bb9 // id: %39
bb9: // Preds: bb8
br bb5(%35 : $TensorHandle<Builtin.Int32>) // id: %40
bb10: // Preds: bb6
%41 = graph_op "Add,i,i"(%23 : $TensorHandle<Builtin.Int32>, %27 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %42
br bb8(%41 : $TensorHandle<Builtin.Int32>) // id: %42
bb11: // Preds: bb5
%43 = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 1, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %44
%44 = graph_op "Add,i,i"(%23 : $TensorHandle<Builtin.Int32>, %43 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %45
br bb8(%44 : $TensorHandle<Builtin.Int32>) // id: %45
bb12: // Preds: bb4
%46 = tuple () // user: %47
return %46 : $() // id: %47
} // end sil function '$S4main5train14iterationCountySi_tF.tf'
----
SIL verification failed: artificial locations are only allowed on Unreachable instructions: InstKind == SILInstructionKind::UnreachableInst
Verifying instruction:
**%1** = = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 0, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // users: %24, %17, %11
**%10** = = graph_op "tfc.RecvFromHost"() {tensorId: i32 0, __device: "/device:CPU:0"} : $TensorHandle<Builtin.Int32> // users: %37, %11
-> %11 = graph_op "Equal,i,i"(%10 : $TensorHandle<Builtin.Int32>, %1 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %14
In function:
// train(iterationCount:)
sil private @$S4main5train14iterationCountySi_tF.tf : $@callee_owned (TensorHandle<Builtin.Int64>) -> () {
// %0 // user: %20
bb0(%0 : $TensorHandle<Builtin.Int64>):
%1 = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 0, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // users: %24, %17, %11
%2 = graph_op "Const"() {dtype$dtype: $Builtin.Int64, value$tensor: i64 1, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // users: %32, %18, %3
%3 = graph_op "Cast,i"(%2 : $TensorHandle<Builtin.Int64>) {DstT$dtype: $Builtin.FPIEEE32, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.FPIEEE32> // user: %5
%4 = graph_op "Const"() {dtype: $Int32, value$tensor: [$Int32: (i32 1000), (i32 784)], value$shape: [$Int32: i32 2], __device: "/device:CPU:0"} : $TensorHandle<Int32> // user: %6
%5 = unchecked_ref_cast %3 : $TensorHandle<Builtin.FPIEEE32> to $TensorHandle<Float> // user: %6
%6 = graph_op "Fill,i,i"(%4 : $TensorHandle<Int32>, %5 : $TensorHandle<Float>) {T: $Float, index_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Float> // user: %7
%7 = graph_op "Shape,i"(%6 : $TensorHandle<Float>) {T: $Float, out_type: $Int32, __device: "/device:CPU:0"} : $TensorHandle<Int32> // user: %8
%8 = graph_op "tfc.SendToHost,i"(%7 : $TensorHandle<Int32>) {tensorId: i32 2, __device: "/device:CPU:0"} : $()
%9 = graph_op "Const"() {dtype$dtype: $Builtin.Int64, value$tensor: i64 0, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %12
%10 = graph_op "tfc.RecvFromHost"() {tensorId: i32 0, __device: "/device:CPU:0"} : $TensorHandle<Builtin.Int32> // users: %37, %11
%11 = graph_op "Equal,i,i"(%10 : $TensorHandle<Builtin.Int32>, %1 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %14
br bb1(%9 : $TensorHandle<Builtin.Int64>) // id: %12
// %13 // users: %18, %20
bb1(%13 : $TensorHandle<Builtin.Int64>): // Preds: bb3 bb0
%14 = graph_op "tf_tensor_to_i1"(%11 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %15
cond_br %14, bb4, bb2 // id: %15
bb2: // Preds: bb1
%16 = graph_op "Const"() {dtype$dtype: $Builtin.FPIEEE64, value$tensor: f64 0x3FF0000000000000 /* 1 */, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.FPIEEE64> // user: %36
br bb5(%1 : $TensorHandle<Builtin.Int32>) // id: %17
bb3: // Preds: bb4
%18 = graph_op "Add,i,i"(%13 : $TensorHandle<Builtin.Int64>, %2 : $TensorHandle<Builtin.Int64>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %19
br bb1(%18 : $TensorHandle<Builtin.Int64>) // id: %19
bb4: // Preds: bb8 bb1
%20 = graph_op "Equal,i,i"(%13 : $TensorHandle<Builtin.Int64>, %0 : $TensorHandle<Builtin.Int64>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %21
%21 = graph_op "tf_tensor_to_i1"(%20 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %22
cond_br %21, bb12, bb3 // id: %22
// %23 // users: %44, %41, %31, %24
bb5(%23 : $TensorHandle<Builtin.Int32>): // Preds: bb9 bb2
%24 = graph_op "Less,i,i"(%23 : $TensorHandle<Builtin.Int32>, %1 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %25
%25 = graph_op "tf_tensor_to_i1"(%24 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %26
cond_br %25, bb6, bb11 // id: %26
bb6: // Preds: bb5
%27 = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 1, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %41
%28 = graph_op "tfc.RecvFromHost"() {tensorId: i32 1, __device: "/device:CPU:0"} : $TensorHandle<Builtin.Int1> // user: %29
%29 = graph_op "tf_tensor_to_i1"(%28 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %30
cond_br %29, bb7, bb10 // id: %30
bb7: // Preds: bb6
%31 = graph_op "Cast,i"(%23 : $TensorHandle<Builtin.Int32>) {DstT$dtype: $Builtin.Int64, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %32
%32 = graph_op "Add,i,i"(%31 : $TensorHandle<Builtin.Int64>, %2 : $TensorHandle<Builtin.Int64>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int64> // user: %33
%33 = graph_op "Cast,i"(%32 : $TensorHandle<Builtin.Int64>) {DstT$dtype: $Builtin.Int32, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %34
br bb8(%33 : $TensorHandle<Builtin.Int32>) // id: %34
// %35 // users: %40, %37
bb8(%35 : $TensorHandle<Builtin.Int32>): // Preds: bb11 bb10 bb7
%36 = unchecked_ref_cast %16 : $TensorHandle<Builtin.FPIEEE64> to $TensorHandle<Double>
%37 = graph_op "Equal,i,i"(%35 : $TensorHandle<Builtin.Int32>, %10 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int1> // user: %38
%38 = graph_op "tf_tensor_to_i1"(%37 : $TensorHandle<Builtin.Int1>) : $Builtin.Int1 // user: %39
cond_br %38, bb4, bb9 // id: %39
bb9: // Preds: bb8
br bb5(%35 : $TensorHandle<Builtin.Int32>) // id: %40
bb10: // Preds: bb6
%41 = graph_op "Add,i,i"(%23 : $TensorHandle<Builtin.Int32>, %27 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %42
br bb8(%41 : $TensorHandle<Builtin.Int32>) // id: %42
bb11: // Preds: bb5
%43 = graph_op "Const"() {dtype$dtype: $Builtin.Int32, value$tensor: i32 1, __device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %44
%44 = graph_op "Add,i,i"(%23 : $TensorHandle<Builtin.Int32>, %43 : $TensorHandle<Builtin.Int32>) {__device: "ALL_DEVICES"} : $TensorHandle<Builtin.Int32> // user: %45
br bb8(%44 : $TensorHandle<Builtin.Int32>) // id: %45
bb12: // Preds: bb4
%46 = tuple () // user: %47
return %46 : $() // id: %47
} // end sil function '$S4main5train14iterationCountySi_tF.tf'
0 swift 0x0000000105090798 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x000000010508f9d7 llvm::sys::RunSignalHandlers() + 39
2 swift 0x0000000105090e12 SignalHandler(int) + 258
3 libsystem_platform.dylib 0x00007fff7d67af5a _sigtramp + 26
4 libsystem_platform.dylib 0x0000000111db5314 _sigtramp + 2490606548
5 libsystem_c.dylib 0x00007fff7d4181ae abort + 127
6 swift 0x000000010259a2bd (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 509
7 swift 0x00000001025b12e4 (anonymous namespace)::SILVerifier::visitSILInstruction(swift::SILInstruction*) + 2708
8 swift 0x00000001025a511b swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) + 31835
9 swift 0x000000010259c05d (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 813
10 swift 0x0000000102596a87 swift::SILFunction::verify(bool) const + 8951
11 swift 0x00000001021b4177 (anonymous namespace)::TFFunctionPartition::partition(bool) + 26679
12 swift 0x000000010219ba5a (anonymous namespace)::TFPartition::run() + 5098
13 swift 0x00000001021d28ba swift::SILPassManager::runModulePass(unsigned int) + 346
14 swift 0x00000001021d3247 swift::SILPassManager::execute() + 759
15 swift 0x00000001018ecfbb swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 187
16 swift 0x00000001021db753 swift::runSILTFPartitionPass(swift::SILModule&) + 99
17 swift 0x000000010178225e performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13742
18 swift 0x000000010177dc38 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2936
19 swift 0x000000010173793e main + 1134
20 libdyld.dylib 0x00007fff7d36c015 start + 1
Stack dump:
0. Program arguments: /Users/danielzheng/swift-dan/build/buildbot_osx/swift-macosx-x86_64/bin/swift -frontend -c -primary-file artificial-loc.swift -target x86_64-apple-darwin17.7.0 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -O -Xllvm -tf-dump-intermediates -module-name main -o /var/folders/bt/fnpw7g250r94nr_g53zqkxgc00hc_q/T/artificial-loc-104a6e.o
1. While running pass #0 SILModuleTransform "TFPartition".
2. While verifying SIL function "@$S4main5train14iterationCountySi_tF.tf".
for 'train(iterationCount:)' at artificial-loc.swift:3:1
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment