Skip to content

Commit b76e8fe

Browse files
committed
[ObjectOutliner] See through move_value insts.
Enables the outlining of the ContiguousArrayStorage<StaticString> used when initializing a RawRepresentable enum whose RawValue is String into a global value to continue even when ContiguousArrayStorage has a lexical lifetime. Addresses the following regressions StringEnumRawValueInitialization 400 7680 +1820.0% **0.05x** ArrayLiteral2 78 647 +729.5% **0.12x** DataCreateSmallArray 1750 8850 +405.7% **0.20x** seen when enabling lexical lifetimes in the standard library.
1 parent 6b18917 commit b76e8fe

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/SILOptimizer/Transforms/ObjectOutliner.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,11 @@ bool ObjectOutliner::getObjectInitVals(SILValue Val,
252252
if (!getObjectInitVals(UC, MemberStores, TailStores, NumTailTupleElements,
253253
toIgnore))
254254
return false;
255+
} else if (auto *mvi = dyn_cast<MoveValueInst>(User)) {
256+
// move_value is transparent.
257+
if (!getObjectInitVals(mvi, MemberStores, TailStores, NumTailTupleElements,
258+
toIgnore))
259+
return false;
255260
} else if (auto *REA = dyn_cast<RefElementAddrInst>(User)) {
256261
// The address of a stored property.
257262
for (Operand *ElemAddrUse : REA->getUses()) {
@@ -316,6 +321,9 @@ static EndCOWMutationInst *getEndCOWMutation(SILValue object) {
316321
// Look through upcast instructions.
317322
if (EndCOWMutationInst *ecm = getEndCOWMutation(upCast))
318323
return ecm;
324+
} else if (auto *mvi = dyn_cast<MoveValueInst>(user)) {
325+
if (auto *ecm = getEndCOWMutation(mvi))
326+
return ecm;
319327
} else if (auto *ecm = dyn_cast<EndCOWMutationInst>(use->getUser())) {
320328
return ecm;
321329
}

0 commit comments

Comments
 (0)