Open
Description
CI testing of the following PR gives me a SIL verification failure on Windows only. The build works fine on macOS and Linux. swiftlang/swift-syntax#1921
SIL verification failed: operand must match type required by pattern
Verifying instruction:
%5 = alloc_stack $SyntaxChildrenIndex // users: %9, %7, %6
-> %7 = keypath $WritableKeyPath<Self, Self.Element>, <τ_0_0 where τ_0_0 : SyntaxCollection> (root $τ_0_0; settable_property $τ_0_0.Element, id @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcig : $@convention(method) <τ_0_0 where τ_0_0 : SyntaxCollection> (@in_guaranteed SyntaxChildrenIndex, @in_guaranteed τ_0_0) -> @out τ_0_0.Element, getter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTK : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (@in_guaranteed τ_0_0, UnsafeRawPointer) -> @out τ_0_0.Element, setter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTk : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (@in_guaranteed τ_0_0.Element, @inout τ_0_0, UnsafeRawPointer) -> (), indices [%$0 : $SyntaxChildrenIndex : $SyntaxChildrenIndex], indices_equals @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTH : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTh : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (UnsafeRawPointer) -> Int) <Self> (%5) // user: %8
%8 = upcast %7 : $WritableKeyPath<Self, Self.Element> to $AnyKeyPath // user: %10
In function:
// SyntaxCollection.keyPath(for:)
sil private [ossa] @$s11SwiftSyntax0B10CollectionPAAE7keyPath33_B3300DB0BA2B3E5E35A338B811650793LL3fors06AnyKeyE0CAA0B13ChildrenIndexV_tF : $@convention(method) <Self where Self : SyntaxCollection> (@in_guaranteed SyntaxChildrenIndex, @in_guaranteed Self) -> @owned AnyKeyPath {
// %0 "index" // user: %2
// %1 "self" // user: %4
bb0(%0 : $*SyntaxChildrenIndex, %1 : $*Self):
%2 = load [trivial] %0 : $*SyntaxChildrenIndex // users: %6, %3
debug_value %2 : $SyntaxChildrenIndex, let, name "index", argno 1 // id: %3
debug_value %1 : $*Self, let, name "self", argno 2, implicit, expr op_deref // id: %4
%5 = alloc_stack $SyntaxChildrenIndex // users: %9, %7, %6
store %2 to [trivial] %5 : $*SyntaxChildrenIndex // id: %6
%7 = keypath $WritableKeyPath<Self, Self.Element>, <τ_0_0 where τ_0_0 : SyntaxCollection> (root $τ_0_0; settable_property $τ_0_0.Element, id @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcig : $@convention(method) <τ_0_0 where τ_0_0 : SyntaxCollection> (@in_guaranteed SyntaxChildrenIndex, @in_guaranteed τ_0_0) -> @out τ_0_0.Element, getter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTK : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (@in_guaranteed τ_0_0, UnsafeRawPointer) -> @out τ_0_0.Element, setter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTk : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (@in_guaranteed τ_0_0.Element, @inout τ_0_0, UnsafeRawPointer) -> (), indices [%$0 : $SyntaxChildrenIndex : $SyntaxChildrenIndex], indices_equals @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTH : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTh : $@convention(thin) <τ_0_0 where τ_0_0 : SyntaxCollection> (UnsafeRawPointer) -> Int) <Self> (%5) // user: %8
%8 = upcast %7 : $WritableKeyPath<Self, Self.Element> to $AnyKeyPath // user: %10
dealloc_stack %5 : $*SyntaxChildrenIndex // id: %9
return %8 : $AnyKeyPath // id: %10
} // end sil function '$s11SwiftSyntax0B10CollectionPAAE7keyPath33_B3300DB0BA2B3E5E35A338B811650793LL3fors06AnyKeyE0CAA0B13ChildrenIndexV_tF
rdar://112552022