Skip to content

Instantly share code, notes, and snippets.

@dan-zheng
Last active July 24, 2018 20:54
Show Gist options
  • Save dan-zheng/f2fa7d05a3b5da2508b5126eda7122e8 to your computer and use it in GitHub Desktop.
Save dan-zheng/f2fa7d05a3b5da2508b5126eda7122e8 to your computer and use it in GitHub Desktop.
SIL verification failed: Basic block contains a non-contiguous lexical scope at -Onone
// crash.swift
import TensorFlow
func test() {
print(Tensor(1))
}
$ swiftc -Xllvm -sil-print-debuginfo crash.swift
SIL verification failed: Basic block contains a non-contiguous lexical scope at -Onone: DS == LastSeenScope
Verifying instruction:
%62 = tuple (), loc "crash.swift":5:1, scope 0 // user: %63
-> return %62 : $(), loc "crash.swift":5:1, scope 0 // id: %63
In function:
sil_scope 1 { loc "crash.swift":3:6 parent @$S5crash4testyyF : $@convention(thin) () -> () }
sil_scope 2 { loc "crash.swift":3:13 parent 1 }
sil_scope 3 { loc "crash.swift":4:9 parent 2 }
sil_scope 4 { parent @$S10TensorFlow0A0VyACyxGxcfC : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@in τ_0_0, @thin Tensor<τ_0_0>.Type) -> @owned Tensor<τ_0_0> inlined_at 3 }
sil_scope 5 { parent 4 inlined_at 3 }
sil_scope 6 { loc "<compiler-generated>":0:0 parent @$S10TensorFlow0A0V6handleACyxGAA0A6HandleCyxG_tcfC : $@convention(method) <τ_0_0 where τ_0_0 : AccelerableByTensorFlow> (@owned TensorHandle<τ_0_0>, @thin Tensor<τ_0_0>.Type) -> @owned Tensor<τ_0_0> inlined_at 5 }
// test()
sil hidden @$S5crash4testyyF : $@convention(thin) () -> () {
bb0:
%0 = integer_literal $Builtin.Word, 1, loc "crash.swift":4:9, scope 2 // user: %2
// function_ref specialized _allocateUninitializedArray<A>(_:)
%1 = function_ref @$Ss27_allocateUninitializedArrayySayxG_BptBwlFyp_Tg5 : $@convention(thin) (Builtin.Word) -> (@owned Array<Any>, Builtin.RawPointer), loc "crash.swift":4:9, scope 2 // user: %2
%2 = apply %1(%0) : $@convention(thin) (Builtin.Word) -> (@owned Array<Any>, Builtin.RawPointer), loc "crash.swift":4:9, scope 2 // users: %5, %3, %6
%3 = tuple_extract %2 : $(Array<Any>, Builtin.RawPointer), 0, loc "crash.swift":4:9, scope 2 // users: %61, %58, %4
retain_value %3 : $Array<Any>, loc "crash.swift":4:9, scope 2 // id: %4
%5 = tuple_extract %2 : $(Array<Any>, Builtin.RawPointer), 1, loc "crash.swift":4:9, scope 2 // user: %7
release_value %2 : $(Array<Any>, Builtin.RawPointer), loc "crash.swift":4:18, scope 2 // id: %6
%7 = pointer_to_address %5 : $Builtin.RawPointer to [strict] $*Any, loc "crash.swift":4:9, scope 2 // user: %8
%8 = init_existential_addr %7 : $*Any, $Tensor<Double>, loc "crash.swift":4:9, scope 2 // user: %52
%9 = string_literal bytes "0A550A1B7466635F66756E635F5335637261736834746573747979462E746612275335637261736834746573747979462E74665F4350552E6465766963655F706172746974696F6E220D2F6465766963653A4350553A300A510A1F7466635F6F75747075745F305F5335637261736834746573747979462E746612084964656E746974791A1B7466635F66756E635F5335637261736834746573747979462E74662A070A01541202300212B9010AB6010A3C0A275335637261736834746573747979462E74665F4350552E6465766963655F706172746974696F6E1A110A0D6F705F746573745F5F5F335F3618021A4D0A0D6F702F746573742E2E2E332E361205436F6E7374220D2F6465766963653A4350553A302A190A0576616C75651210420E080212003208000000000000F03F2A0B0A0564747970651202300222270A0D6F705F746573745F5F5F335F3612166F702F746573742E2E2E332E363A6F75747075743A302204081A100C", loc "crash.swift":3:6, scope 1 // user: %13
%10 = integer_literal $Builtin.Int64, 364, loc "crash.swift":3:6, scope 1 // user: %15
%11 = string_literal utf8 "S5crash4testyyF.tf", loc "crash.swift":3:6, scope 1 // user: %14
%12 = integer_literal $Builtin.Int64, 0, loc "crash.swift":3:6, scope 1 // user: %16
%13 = struct $UnsafeRawPointer (%9 : $Builtin.RawPointer), loc "crash.swift":3:6, scope 1 // user: %26
%14 = struct $UnsafePointer<Int8> (%11 : $Builtin.RawPointer), loc "crash.swift":3:6, scope 1 // user: %26
%15 = struct $Int (%10 : $Builtin.Int64), loc "crash.swift":3:6, scope 1 // user: %26
%16 = struct $Int (%12 : $Builtin.Int64), loc "crash.swift":3:6, scope 1 // user: %26
%17 = alloc_stack $OpaquePointer, loc "crash.swift":3:6, scope 1 // users: %28, %18
%18 = begin_access [read] [static] %17 : $*OpaquePointer, loc "crash.swift":3:6, scope 1 // users: %27, %19
%19 = address_to_pointer %18 : $*OpaquePointer to $Builtin.RawPointer, loc "crash.swift":3:6, scope 1 // user: %20
%20 = struct $UnsafePointer<OpaquePointer> (%19 : $Builtin.RawPointer), loc "crash.swift":3:6, scope 1 // user: %26
%21 = integer_literal $Builtin.Int64, 0, loc "crash.swift":3:6, scope 1 // user: %22
%22 = struct $Int (%21 : $Builtin.Int64), loc "crash.swift":3:6, scope 1 // user: %26
%23 = integer_literal $Builtin.Int64, 1, loc "crash.swift":3:6, scope 1 // user: %24
%24 = struct $Int (%23 : $Builtin.Int64), loc "crash.swift":3:6, scope 1 // users: %34, %26
// function_ref _swift_tfc_StartTensorComputation
%25 = function_ref @_swift_tfc_StartTensorComputation : $@convention(thin) (UnsafeRawPointer, Int, UnsafePointer<Int8>, UnsafePointer<OpaquePointer>, Int, Int, Int) -> @owned _TensorComputation, loc "crash.swift":3:6, scope 1 // user: %26
%26 = apply %25(%13, %15, %14, %20, %22, %16, %24) : $@convention(thin) (UnsafeRawPointer, Int, UnsafePointer<Int8>, UnsafePointer<OpaquePointer>, Int, Int, Int) -> @owned _TensorComputation, loc "crash.swift":3:6, scope 1 // user: %34
end_access %18 : $*OpaquePointer, loc "crash.swift":3:6, scope 1 // id: %27
dealloc_stack %17 : $*OpaquePointer, loc "crash.swift":3:6, scope 1 // id: %28
%29 = alloc_stack $OpaquePointer, loc "crash.swift":3:6, scope 1 // users: %40, %36, %30
%30 = begin_access [modify] [static] %29 : $*OpaquePointer, loc "crash.swift":3:6, scope 1 // users: %35, %31
%31 = address_to_pointer %30 : $*OpaquePointer to $Builtin.RawPointer, loc "crash.swift":3:6, scope 1 // user: %32
%32 = struct $UnsafeMutablePointer<OpaquePointer> (%31 : $Builtin.RawPointer), loc "crash.swift":3:6, scope 1 // user: %34
// function_ref _swift_tfc_FinishTensorComputation
%33 = function_ref @_swift_tfc_FinishTensorComputation : $@convention(thin) (@guaranteed _TensorComputation, UnsafeMutablePointer<OpaquePointer>, Int) -> (), loc "crash.swift":3:6, scope 1 // user: %34
%34 = apply %33(%26, %32, %24) : $@convention(thin) (@guaranteed _TensorComputation, UnsafeMutablePointer<OpaquePointer>, Int) -> (), loc "crash.swift":3:6, scope 1
end_access %30 : $*OpaquePointer, loc "crash.swift":3:6, scope 1 // id: %35
%36 = load %29 : $*OpaquePointer, scope 1 // user: %39
%37 = alloc_ref $TensorHandle<Double>, scope 1 // users: %51, %50, %45, %43, %44, %38
%38 = ref_element_addr %37 : $TensorHandle<Double>, #TensorHandle.cTensorHandle, scope 1 // user: %39
store %36 to %38 : $*OpaquePointer, scope 1 // id: %39
dealloc_stack %29 : $*OpaquePointer, loc "crash.swift":3:6, scope 1 // id: %40
%41 = alloc_stack $Tensor<Double>, scope 6 // users: %42, %46, %49
%42 = struct_element_addr %41 : $*Tensor<Double>, #Tensor.handle, scope 6 // user: %43
store %37 to %42 : $*TensorHandle<Double>, scope 6 // id: %43
%44 = struct $Tensor<Double> (%37 : $TensorHandle<Double>), scope 6 // user: %52
strong_retain %37 : $TensorHandle<Double>, scope 6 // id: %45
%46 = load %41 : $*Tensor<Double>, scope 6 // user: %47
%47 = struct_extract %46 : $Tensor<Double>, #Tensor.handle, scope 6 // user: %48
strong_release %47 : $TensorHandle<Double>, scope 6 // id: %48
dealloc_stack %41 : $*Tensor<Double>, scope 6 // id: %49
strong_retain %37 : $TensorHandle<Double>, scope 4 // id: %50
strong_release %37 : $TensorHandle<Double>, scope 4 // id: %51
store %44 to %8 : $*Tensor<Double>, loc "crash.swift":4:9, scope 2 // id: %52
// function_ref default argument 1 of print(_:separator:terminator:)
%53 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA0_ : $@convention(thin) () -> @owned String, loc "crash.swift":4:9, scope 2 // user: %54
%54 = apply %53() : $@convention(thin) () -> @owned String, loc "crash.swift":4:9, scope 2 // users: %60, %58
// function_ref default argument 2 of print(_:separator:terminator:)
%55 = function_ref @$Ss5print_9separator10terminatoryypd_S2StFfA1_ : $@convention(thin) () -> @owned String, loc "crash.swift":4:9, scope 2 // user: %56
%56 = apply %55() : $@convention(thin) () -> @owned String, loc "crash.swift":4:9, scope 2 // users: %59, %58
// function_ref print(_:separator:terminator:)
%57 = function_ref @$Ss5print_9separator10terminatoryypd_S2StF : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> (), loc "crash.swift":4:3, scope 2 // user: %58
%58 = apply %57(%3, %54, %56) : $@convention(thin) (@guaranteed Array<Any>, @guaranteed String, @guaranteed String) -> (), loc "crash.swift":4:3, scope 2
release_value %56 : $String, loc "crash.swift":4:18, scope 2 // id: %59
release_value %54 : $String, loc "crash.swift":4:18, scope 2 // id: %60
release_value %3 : $Array<Any>, loc "crash.swift":4:18, scope 2 // id: %61
%62 = tuple (), loc "crash.swift":5:1, scope 2 // user: %63
return %62 : $(), loc "crash.swift":5:1, scope 2 // id: %63
} // end sil function '$S5crash4testyyF'
0 swift 0x00000001103ad848 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x00000001103aca87 llvm::sys::RunSignalHandlers() + 39
2 swift 0x00000001103adec2 SignalHandler(int) + 258
3 libsystem_platform.dylib 0x00007fff58f3cf5a _sigtramp + 26
4 libsystem_platform.dylib 0x0000000112850608 _sigtramp + 3113301704
5 libsystem_c.dylib 0x00007fff58cda1ae abort + 127
6 swift 0x000000010d8b936d (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 509
7 swift 0x000000010d8bdec7 (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 1751
8 swift 0x000000010d8bbfe7 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 9415
9 swift 0x000000010d8b872c swift::SILModule::verify() const + 236
10 swift 0x000000010cad1d60 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 14352
11 swift 0x000000010cacd4d8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2936
12 swift 0x000000010ca87218 main + 1128
13 libdyld.dylib 0x00007fff58c2e015 start + 1
14 libdyld.dylib 0x0000000000000011 start + 2805800957
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-tensorflow-DEVELOPMENT-2018-07-19-a.xctoolchain/usr/bin/swift -frontend -c -primary-file crash.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 -Xllvm -sil-print-debuginfo -color-diagnostics -module-name crash -o /var/folders/bt/fnpw7g250r94nr_g53zqkxgc00hc_q/T/crash-8b9d4f.o
1. While verifying SIL function "@$S5crash4testyyF".
for 'test()' at crash.swift:3:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment