Skip to content

[SR-7703] Creating an array with 10.000 elements is slow with optimization. #50243

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-7703
Radar rdar://problem/40334734
Original Reporter andreasw (JIRA User)
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @eeckstein
Priority Medium

md5: a9f53d8799e79775521d84b544cb5974

is duplicated by:

Issue Description:

After #50173 and #50231 were fixed, compiling large arrays works fine without optimization, in a non-asserting build where the SILVerifier is disabled (still waiting for #50242).

Switching on -O slows down compilation again. See the attached Makefile how I create an array of 10.000 Int elements. Compiling with -O takes 16 seconds.

Here are the offending functions from perf:

+ 58,96% 0,05% swift swift [.] (anonymous namespace)::RedundantLoadElimination::run ▒
+ 57,33% 2,04% swift swift [.] (anonymous namespace)::BlockState::processStoreInst ▒
+ 50,06% 28,52% swift swift [.] llvm::DenseMapBase<llvm::SmallDenseMap<swift::LSLocation, unsigned int, 32u, llvm::DenseMa▒
+ 32,62% 2,89% swift swift [.] swift::LSLocation::isMayAliasLSLocation ▒
+ 32,01% 0,05% swift swift [.] swift::LSLocation::enumerateLSLocation ▒
+ 31,97% 0,07% swift swift [.] swift::LSLocation::enumerateLSLocations ▒
+ 21,43% 10,09% swift swift [.] swift::LSBase::hasIdenticalProjectionPath ▒
+ 18,76% 4,43% swift swift [.] swift::AliasAnalysis::alias ▒
+ 11,32% 11,25% swift swift [.] swift::ProjectionPath::computeSubSeqRelation ▒
+ 10,97% 10,95% swift swift [.] swift::ProjectionPath::hasNonEmptySymmetricDifference ▒
+ 8,96% 8,95% swift swift [.] swift::ValueEnumerator<swift::ValueBase*, unsigned long>::getIndex ▒
+ 8,49% 0,00% swift swift [.] swift::SILPassManager::runFunctionPasses ▒
+ 8,42% 0,00% swift swift [.] swift::SILPassManager::runPassOnFunction ▒
+ 6,72% 0,01% swift swift [.] llvm::DenseMapBase<llvm::SmallDenseMap<swift::LSLocation, unsigned int, 32u, llvm::DenseMa▒
+ 5,37% 5,36% swift swift [.] llvm::DenseMapBase<llvm::DenseMap<(anonymous namespace)::AliasKeyTy, swift::AliasAnalysis:▒
+ 5,35% 0,00% swift swift [.] llvm::DenseMapBase<llvm::SmallDenseMap<swift::LSLocation, unsigned int, 32u, llvm::DenseMa▒

Metadata

Metadata

Assignees

Labels

SILOptimizerArea → compiler: SIL optimization passesarray literalsFeature → expressions → literals: Array literalsbugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfexpressionsFeature: expressionsliteralsFeature → expressions: Literals such as an integer or string literaloptimized onlyFlag: An issue whose reproduction requires optimized compilationperformanceswift 5.8

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions