mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Add NestedSemanticFunctionCheck diagnostic
to check for improperly nested '@_semantic' functions.
Add a missing @_semantics("array.init") in ArraySlice found by the
diagnostic.
Distinguish between array.init and array.init.empty.
Categorize the types of semantic functions by how they affect the
inliner and pass pipeline, and centralize this logic in
PerformanceInlinerUtils. The ultimate goal is to prevent inlining of
"Fundamental" @_semantics calls and @_effects calls until the late
pipeline where we can safely discard semantics. However, that requires
significant pipeline changes.
In the meantime, this change prevents the situation from getting worse
and makes the intention clear. However, it has no significant effect
on the pass pipeline and inliner.
This commit is contained in:
@@ -295,6 +295,7 @@ static bool isNonMutatingArraySemanticCall(SILInstruction *Inst) {
|
||||
case ArrayCallKind::kReserveCapacityForAppend:
|
||||
case ArrayCallKind::kWithUnsafeMutableBufferPointer:
|
||||
case ArrayCallKind::kArrayInit:
|
||||
case ArrayCallKind::kArrayInitEmpty:
|
||||
case ArrayCallKind::kArrayUninitialized:
|
||||
case ArrayCallKind::kArrayUninitializedIntrinsic:
|
||||
case ArrayCallKind::kArrayFinalizeIntrinsic:
|
||||
@@ -658,6 +659,7 @@ bool COWArrayOpt::hasLoopOnlyDestructorSafeArrayOperations() {
|
||||
auto Kind = Sem.getKind();
|
||||
// Safe because they create new arrays.
|
||||
if (Kind == ArrayCallKind::kArrayInit ||
|
||||
Kind == ArrayCallKind::kArrayInitEmpty ||
|
||||
Kind == ArrayCallKind::kArrayUninitialized ||
|
||||
Kind == ArrayCallKind::kArrayUninitializedIntrinsic)
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user