Skip to content

Instantly share code, notes, and snippets.

@zoecarver
Created November 5, 2019 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zoecarver/f6e72b1d6364657641c8801d9e32f0e0 to your computer and use it in GitHub Desktop.
Save zoecarver/f6e72b1d6364657641c8801d9e32f0e0 to your computer and use it in GitHub Desktop.
SIL verification failed: Operand is of an ArchetypeType that does not exist in the Caller's generic param list.: isArchetypeValidInFunction(A, F)
Verifying instruction:
%0 = argument of bb0 : $τ_1_0 // user: %1
-> %1 = init_existential_ref %0 : $τ_1_0 : $τ_1_0, $ClassA<T> & ProtocolA // users: %3, %2
debug_value %1 : $ClassA<T> & ProtocolA, let, name "x", argno 1 // id: %2
%3 = open_existential_ref %1 : $ClassA<T> & ProtocolA to $@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA // users: %7, %6, %5, %4
In function:
// specialized shouldOptimize1<A>(_:)
sil shared @$s3run15shouldOptimize1ySiAA9ProtocolA_AA6ClassACyxGXclFTf4e_n : $@convention(thin) <τ_0_0><τ_1_0 where τ_1_0 : ClassA<τ_0_0>, τ_1_0 : ProtocolA> (@guaranteed τ_1_0) -> Int {
// %0 // user: %1
bb0(%0 : $τ_1_0):
%1 = init_existential_ref %0 : $τ_1_0 : $τ_1_0, $ClassA<T> & ProtocolA // users: %3, %2
debug_value %1 : $ClassA<T> & ProtocolA, let, name "x", argno 1 // id: %2
%3 = open_existential_ref %1 : $ClassA<T> & ProtocolA to $@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA // users: %7, %6, %5, %4
%4 = alloc_stack $@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA // type-defs: %3; users: %8, %7, %5
store %3 to %4 : $*@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA // id: %5
%6 = witness_method $@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA, #ProtocolA.foo!1 : <Self where Self : ProtocolA> (Self) -> () -> Int, %3 : $@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA : $@convention(witness_method: ProtocolA) <τ_0_0 where τ_0_0 : ProtocolA> (@in_guaranteed τ_0_0) -> Int // type-defs: %3; user: %7
%7 = apply %6<@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA>(%4) : $@convention(witness_method: ProtocolA) <τ_0_0 where τ_0_0 : ProtocolA> (@in_guaranteed τ_0_0) -> Int // type-defs: %3; user: %9
dealloc_stack %4 : $*@opened("1A205440-FF82-11E9-A915-ACBC329C418B") ClassA<τ_0_0> & ProtocolA // id: %8
return %7 : $Int // id: %9
} // end sil function '$s3run15shouldOptimize1ySiAA9ProtocolA_AA6ClassACyxGXclFTf4e_n'
Stack dump:
0. Program arguments: /Users/zoe/Developer/swift-source/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swift -frontend -emit-sil -primary-file run.swift -target x86_64-apple-darwin18.6.0 -enable-objc-interop -color-diagnostics -O -module-name run -o -
1. Swift version 5.1.1-dev (Swift 74328cdda2)
2. While verifying SIL function "@$s3run15shouldOptimize1ySiAA9ProtocolA_AA6ClassACyxGXclFTf4e_n".
for 'shouldOptimize1(_:)' (at run.swift:21:1)
0 swift 0x0000000112e51bfc llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1 swift 0x0000000112e52159 PrintStackTraceSignalHandler(void*) + 25
2 swift 0x0000000112e4fe16 llvm::sys::RunSignalHandlers() + 118
3 swift 0x0000000112e55ad2 SignalHandler(int) + 210
4 libsystem_platform.dylib 0x00007fff7a1bfb5d _sigtramp + 29
5 libsystem_platform.dylib 0x000000012d945ee8 _sigtramp + 3011011496
6 libsystem_c.dylib 0x00007fff7a0796a6 abort + 127
7 swift 0x000000010b33c192 (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 386
8 swift 0x000000010b350d97 (anonymous namespace)::SILVerifier::checkLegalSILType(swift::SILFunction*, swift::CanType, swift::SILInstruction*)::'lambda'(swift::CanType)::operator()(swift::CanType) const + 247
9 swift 0x000000010b350c98 void llvm::function_ref<void (swift::CanType)>::callback_fn<(anonymous namespace)::SILVerifier::checkLegalSILType(swift::SILFunction*, swift::CanType, swift::SILInstruction*)::'lambda'(swift::CanType)>(long, swift::CanType) + 56
10 swift 0x000000010b297d64 llvm::function_ref<void (swift::CanType)>::operator()(swift::CanType) const + 68
11 swift 0x000000010b297d10 swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const::'lambda'(swift::Type)::operator()(swift::Type) const + 64
12 swift 0x000000010b297cb8 bool llvm::function_ref<bool (swift::CanType)>::callback_fn<swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const::'lambda'(swift::Type)>(long, swift::CanType) + 56
13 swift 0x000000010c574c34 llvm::function_ref<bool (swift::CanType)>::operator()(swift::CanType) const + 68
14 swift 0x000000010c574bd0 swift::CanType::findIf(llvm::function_ref<bool (swift::CanType)>) const::'lambda'(swift::Type)::operator()(swift::Type) const + 64
15 swift 0x000000010c574b78 bool llvm::function_ref<bool (swift::Type)>::callback_fn<swift::CanType::findIf(llvm::function_ref<bool (swift::CanType)>) const::'lambda'(swift::Type)>(long, swift::Type) + 56
16 swift 0x000000010c583244 llvm::function_ref<bool (swift::Type)>::operator()(swift::Type) const + 68
17 swift 0x000000010c583194 swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const::Walker::walkToTypePre(swift::Type) + 52
18 swift 0x000000010c5bee82 (anonymous namespace)::Traversal::doIt(swift::Type) + 50
19 swift 0x000000010c5c0e5c (anonymous namespace)::Traversal::visitBoundGenericType(swift::BoundGenericType*) + 204
20 swift 0x000000010c5bfe78 swift::TypeVisitor<(anonymous namespace)::Traversal, bool>::visitBoundGenericClassType(swift::BoundGenericClassType*) + 40
21 swift 0x000000010c5bf395 swift::TypeVisitor<(anonymous namespace)::Traversal, bool>::visit(swift::Type) + 869
22 swift 0x000000010c5beeeb (anonymous namespace)::Traversal::doIt(swift::Type) + 155
23 swift 0x000000010c5c08fc (anonymous namespace)::Traversal::visitProtocolCompositionType(swift::ProtocolCompositionType*) + 124
24 swift 0x000000010c5bf719 swift::TypeVisitor<(anonymous namespace)::Traversal, bool>::visit(swift::Type) + 1769
25 swift 0x000000010c5beeeb (anonymous namespace)::Traversal::doIt(swift::Type) + 155
26 swift 0x000000010c5bee0b swift::Type::walk(swift::TypeWalker&) const + 75
27 swift 0x000000010c57378d swift::Type::walk(swift::TypeWalker&&) const + 29
28 swift 0x000000010c55f5e0 swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const + 80
29 swift 0x000000010c55ee99 swift::CanType::findIf(llvm::function_ref<bool (swift::CanType)>) const + 73
30 swift 0x000000010b297bbc swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const + 76
31 swift 0x000000010b350bb9 (anonymous namespace)::SILVerifier::checkLegalSILType(swift::SILFunction*, swift::CanType, swift::SILInstruction*) + 953
32 swift 0x000000010b3507bd (anonymous namespace)::SILVerifier::checkLegalType(swift::SILFunction*, swift::SILType, swift::SILInstruction*) + 77
33 swift 0x000000010b34fa7a (anonymous namespace)::SILVerifier::checkLegalType(swift::SILFunction*, swift::ValueBase*, swift::SILInstruction*) + 250
34 swift 0x000000010b355c43 (anonymous namespace)::SILVerifier::visitSILInstruction(swift::SILInstruction*) + 451
35 swift 0x000000010b355a78 swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visitSingleValueInstruction(swift::SingleValueInstruction*) + 40
36 swift 0x000000010b354677 (anonymous namespace)::SILVerifierBase<(anonymous namespace)::SILVerifier>::visitInitExistentialRefInst(swift::InitExistentialRefInst*) + 39
37 swift 0x000000010b34e70d swift::SILInstructionVisitor<(anonymous namespace)::SILVerifier, void>::visit(swift::SILInstruction*) + 4269
38 swift 0x000000010b34c7da swift::SILVisitorBase<(anonymous namespace)::SILVerifier, void>::visitSILBasicBlock(swift::SILBasicBlock*) + 138
39 swift 0x000000010b348076 (anonymous namespace)::SILVerifier::visitSILBasicBlock(swift::SILBasicBlock*) + 710
40 swift 0x000000010b34001b (anonymous namespace)::SILVerifier::visitSILBasicBlocks(swift::SILFunction*) + 187
41 swift 0x000000010b33e35a (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 794
42 swift 0x000000010b337519 (anonymous namespace)::SILVerifier::verify() + 25
43 swift 0x000000010b3374ab swift::SILFunction::verify(bool) const + 59
44 swift 0x000000010b33a679 swift::SILModule::verify() const + 441
45 swift 0x000000010a41f380 swift::CompilerInstance::performSILProcessing(swift::SILModule*, swift::UnifiedStatsReporter*) + 192
46 swift 0x0000000109eddac0 performCompileStepsPostSILGen(swift::CompilerInstance&, swift::CompilerInvocation&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, bool, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1056
47 swift 0x0000000109ec44fd performCompileStepsPostSema(swift::CompilerInvocation&, swift::CompilerInstance&, bool, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1373
48 swift 0x0000000109eba1c5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1621
49 swift 0x0000000109eb8db9 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2121
50 swift 0x0000000109daa234 run_driver(llvm::StringRef, llvm::ArrayRef<char const*>) + 292
51 swift 0x0000000109da9543 main + 1875
52 libdyld.dylib 0x00007fff79fd43d5 start + 1
[1] 7971 abort bin/swiftc run.swift -O -emit-sil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment