Commits

Xin Tong committed 8dc7ae522d5
Implement a type expansion analysis pass. This pass caches the expansion of a type to its individual fields. i.e. a map between SILType and a list of ProjectionPath is cached. This pass is immutable and never invalidated. Redundant load elimination and dead store elimination use this pass to improve compilation time. I see the hit rate of the cache to be ~95%. Without the pass. ---------------- Running Time Self (ms) Symbol Name 16338.0ms 28.2% 62.0 swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) 2716.0ms 4.6% 5.0 (anonymous namespace)::SimplifyCFGPass::run() 2654.0ms 4.5% 12.0 (anonymous namespace)::ARCSequenceOpts::run() 2218.0ms 3.8% 7.0 (anonymous namespace)::SILCombine::run() 1660.0ms 2.8% 66.0 (anonymous namespace)::SILCSE::run() 1625.0ms 2.8% 120.0 (anonymous namespace)::RedundantLoadElimination::run() 1491.0ms 2.5% 35.0 (anonymous namespace)::DeadStoreElimination::run() 1213.0ms 2.0% 1.0 swift::BottomUpFunctionOrder::getFunctions() 777.0ms 1.3% 127.0 (anonymous namespace)::DCE::run() 381.0ms 0.6% 2.0 (anonymous namespace)::SILCodeMotion::run() With the pass. -------------- Running Time Self (ms) Symbol Name 15866.0ms 26.8% 73.0 swift::SILPassManager::runFunctionPasses(llvm::ArrayRef<swift::SILFunctionTransform*>) 2736.0ms 4.6% 6.0 (anonymous namespace)::SimplifyCFGPass::run() 2696.0ms 4.5% 14. (anonymous namespace)::ARCSequenceOpts::run() 2393.0ms 4.0% 7.0 (anonymous namespace)::SILCombine::run() 1673.0ms 2.8% 81. (anonymous namespace)::SILCSE::run() 1290.0ms 2.1% 2.0 swift::BottomUpFunctionOrder::getFunctions() 1288.0ms 2.1% 17.0 swift::BottomUpFunctionOrder::FindSCCs(swift::SILModule&) 1140.0ms 1.9% 138.0 (anonymous namespace)::RedundantLoadElimination::run() 1119.0ms 1.8% 21.0 (anonymous namespace)::DeadStoreElimination::run() 749.0ms 1.2% 147.0 (anonymous namespace)::DCE::run() 379.0ms 0.6% 7.0 (anonymous namespace)::SILCodeMotion::run() 256.0ms 0.4% 11.0 (anonymous namespace)::ABCOpt::run()