Skip to content

Commit e69ff06

Browse files
author
Ben Ng
committed
Fix performance regression
1 parent 472f442 commit e69ff06

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

lib/SILOptimizer/PassManager/PassPipeline.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ void addHighLevelLoopOptPasses(SILPassPipelinePlan &P) {
180180
P.addSimplifyCFG();
181181
P.addPerformanceConstantPropagation();
182182
P.addSimplifyCFG();
183-
P.addArrayElementPropagation();
184183
// End of unrolling passes.
185184
P.addRemovePins();
186185
P.addABCOpt();
@@ -295,6 +294,7 @@ static void addHighLevelEarlyLoopOptPipeline(SILPassPipelinePlan &P) {
295294
P.startPipeline("HighLevel+EarlyLoopOpt");
296295
// FIXME: update this to be a function pass.
297296
P.addEagerSpecializer();
297+
P.addArrayElementPropagation();
298298
addSSAPasses(P, OptimizationLevelKind::HighLevel);
299299
addHighLevelLoopOptPasses(P);
300300
}

lib/SILOptimizer/Transforms/PerformanceInliner.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ SILFunction *SILPerformanceInliner::getEligibleFunction(FullApplySite AI) {
228228
// Don't inline functions that are marked with the @_semantics or @effects
229229
// attribute if the inliner is asked not to inline them.
230230
if (Callee->hasSemanticsAttrs() || Callee->hasEffectsKind()) {
231-
if (WhatToInline == InlineSelection::NoSemanticsAndGlobalInit) {
231+
if (WhatToInline == InlineSelection::NoSemanticsAndGlobalInit &&
232+
!Callee->hasSemanticsAttr("early_inline")) {
232233
return nullptr;
233234
}
234235
// The "availability" semantics attribute is treated like global-init.

stdlib/public/core/Arrays.swift.gyb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
13381338
/// bridged `NSArray` instance as its storage, the efficiency is
13391339
/// unspecified.
13401340
@_semantics("array.append_element")
1341+
@_semantics("early_inline")
13411342
public mutating func append(_ newElement: Element) {
13421343
_makeUniqueAndReserveCapacityIfNotUnique()
13431344
let oldCount = _getCount()
@@ -1360,6 +1361,7 @@ extension ${Self} : RangeReplaceableCollection, _ArrayProtocol {
13601361
///
13611362
/// - Complexity: O(*n*), where *n* is the length of the resulting array.
13621363
@_semantics("array.append_contentsOf")
1364+
@_semantics("early_inline")
13631365
public mutating func append<S : Sequence>(contentsOf newElements: S)
13641366
where S.Iterator.Element == Element {
13651367

0 commit comments

Comments
 (0)