Skip to content

Commit 9d1ae9a

Browse files
committed
Don't perform array property specialization at Osize.
1 parent d85b35b commit 9d1ae9a

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/SILOptimizer/LoopTransforms/COWArrayOpt.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2292,9 +2292,16 @@ class SwiftArrayOptPass : public SILFunctionTransform {
22922292
if (!ShouldSpecializeArrayProps)
22932293
return;
22942294

2295+
auto *Fn = getFunction();
2296+
2297+
// Don't hoist array property calls at Osize.
2298+
auto OptMode = Fn->getModule().getOptions().Optimization;
2299+
if (OptMode == SILOptions::SILOptMode::OptimizeForSize)
2300+
return;
2301+
22952302
DominanceAnalysis *DA = PM->getAnalysis<DominanceAnalysis>();
22962303
SILLoopAnalysis *LA = PM->getAnalysis<SILLoopAnalysis>();
2297-
SILLoopInfo *LI = LA->get(getFunction());
2304+
SILLoopInfo *LI = LA->get(Fn);
22982305

22992306
bool HasChanged = false;
23002307

0 commit comments

Comments
 (0)