File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ extension OutputSpan where Element: ~Copyable {
8383 /// The number of initialized elements in this span.
8484 @_alwaysEmitIntoClient
8585 @_semantics ( " fixed_storage.get_count " )
86- public var count : Int { _count }
86+ public var count : Int { _assumeNonNegative ( _count) }
8787
8888 /// The number of additional elements that can be added to this span.
8989 @_alwaysEmitIntoClient
@@ -191,7 +191,7 @@ extension OutputSpan where Element: ~Copyable {
191191 /// The range of initialized positions for this `OutputSpan`.
192192 @_alwaysEmitIntoClient
193193 public var indices : Range < Index > {
194- unsafe Range( _uncheckedBounds: ( 0 , _count ) )
194+ unsafe Range( _uncheckedBounds: ( 0 , count ) )
195195 }
196196
197197 // SILOptimizer looks for fixed_storage.check_index semantics for bounds check optimizations.
Original file line number Diff line number Diff line change @@ -171,3 +171,12 @@ public func sorted(_ span: borrowing MutableSpan<Int>) -> Bool {
171171 return true
172172}
173173
174+ // CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests22outputspan_get_elementySis10OutputSpanVySiG_SitF :
175+ // CHECK-SIL: [[REG1:%.*]] = struct_extract %0, #OutputSpan._count
176+ // CHECK-SIL: [[REG2:%.*]] = struct_extract [[REG1]], #Int._value
177+ // CHECK-SIL: [[REG3:%.*]] = builtin "assumeNonNegative_Int64"([[REG2]]) : $Builtin.Int64
178+ // CHECK-SIL-LABEL:} // end sil function '$s31mutable_span_bounds_check_tests22outputspan_get_elementySis10OutputSpanVySiG_SitF'
179+ public func outputspan_get_element( _ v: borrowing OutputSpan < Int > , _ i: Int ) -> Int {
180+ return v [ i]
181+ }
182+
You can’t perform that action at this time.
0 commit comments