mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
stdlib, optimizer: add Array. reserveCapacityForAppend as a new array semantics operation.
This function reserves capacity in an Array for new elements which are about to be appended.
This commit is contained in:
@@ -162,6 +162,8 @@ ArrayCallKind swift::ArraySemanticsCall::getKind() const {
|
||||
.Case("array.get_element_address",
|
||||
ArrayCallKind::kGetElementAddress)
|
||||
.Case("array.mutate_unknown", ArrayCallKind::kMutateUnknown)
|
||||
.Case("array.reserve_capacity_for_append",
|
||||
ArrayCallKind::kReserveCapacityForAppend)
|
||||
.Case("array.withUnsafeMutableBufferPointer",
|
||||
ArrayCallKind::kWithUnsafeMutableBufferPointer)
|
||||
.Case("array.append_contentsOf", ArrayCallKind::kAppendContentsOf)
|
||||
@@ -570,6 +572,7 @@ bool swift::ArraySemanticsCall::canInlineEarly() const {
|
||||
default:
|
||||
return false;
|
||||
case ArrayCallKind::kAppendContentsOf:
|
||||
case ArrayCallKind::kReserveCapacityForAppend:
|
||||
case ArrayCallKind::kAppendElement:
|
||||
// append(Element) calls other semantics functions. Therefore it's
|
||||
// important that it's inlined by the early inliner (which is before all
|
||||
|
||||
Reference in New Issue
Block a user