Commits

Andrew Trick committed db6a37ddbbc
Enable the CopyForwarding pass in -O. If there are any nontrivial issues with this pass, aside from random inlining noise, we should disable it for Xcode 6.4. This can be verified via: --extra-swift-args=".;-Xllvm\;enable-copyforwarding=false\;-Xllvm\;-enable-destroyhoisting=false" This is not enabled at -Onone. We don't currently have a way to control the optimization without potentially affecting the debugging experience. People may expect debug values for variables past their last use. It looks like this is about a 3% compile time improvement on stdlib-RA due to reducing SIL early in the pipeline. Performance: Most of the big gains with this optimization disappeared when generic inlining was enabled. This is good, because it means generic inlining is doing its job. CopyForwarding mainly benefits generic code that doesn't get inlined. There are still plenty of significant performance improvements, along with reducing the size of the SIL code early. The regressions shown below related to inlining heuristics, not the optimization itself. CopyForwarding is actually a speedup or neutral in all of these cases when we just increase the inlining threshold. By reducing the size of the SIL code, inlining decisions are very different because we use a silly bottom-up threshold approach. I've been fixing regressions for months in preparation for enabling the feature, but it's a losing battle. e.g the Ary and PrimeNum regressions did not exist before generic inlining was enabled this week. Instead, I'm just tracking the inlining issues, which are in the process of being fixed. -O slowdowns |_RangeAssignment___________|____-81.6%_| |_Ary_______________________|____-38.7%_| |_Ary2______________________|____-29.9%_| |_PrimeNum__________________|____-22.6%_| |_EditDistance______________|____-13.2%_| <rdar://problem/19426897> [Inliner] Fail to fully optimize RangeAssignment (especially with copy forwarding) <rdar://problem/19430635> [Inliner] 2x regression on Ary and Ary2 with copyforwarding <rdar://problem/19431694> [Inliner] 24% slowdown in PrimeNum with CopyForwarding <rdar://problem/19432662> [Inliner] 19% slowdown in EditDistance with CopyForwarding -O speedups |_Phonebook_______________|_____57.2%_| |_ProtocolDispatch________|_____36.4%_| |_SwiftStructuresTrie_____|_____32.5%_| |_StdlibSort______________|_____27.7%_| |_StringWalk______________|_____20.4%_| |_ArrayOfRef______________|_____19.7%_| |_ArrayOfGenericRef_______|_____18.3%_| |_JSONHelperDeserialize___|_____14.1%_| |_DollarFilter____________|_____14.0%_| |_NSXMLParser_____________|_____13.9%_| |_CaptureProp_____________|_____12.6%_| |_Havlak__________________|_____10.7%_| |_DollarMap_______________|_____10.3%_| |_SortStrings_____________|______9.5%_| |_DollarReduce____________|______9.5%_| |_SwiftStructuresStack____|______9.1%_| |_NopDeinit_______________|______8.7%_| |_Dictionary3_____________|______8.6%_| |_DollarChain_____________|______6.4%_| |_DollarFunction__________|______5.6%_| |_StrSplitter_____________|______5.4%_| |_PolymorphicCalls________|______5.4%_| |_GenericStack____________|______5.3%_| |_NSDictionaryImplicitConversion_|______5.4%__| Possible_improvements,_but_likely_noise: |_Random__________________|_5.5%_(!)_| |_RecursiveOwnedParameter_|_5.2%_(!)_| -Ounchecked slowdowns |_RangeAssignment______|_-69.4%_| |_Ary__________________|_-41.8%_| |_Ary2_________________|_-32.6%_| |_PopFrontArrayGeneric_|_-14.2%_| |_EditDistance_________|_-10.3%_| |_ImageProc____________|__-8.7%_| |_PrimeNum_____________|__-7.3%_| <rdar://problem/19433097> [Inliner] 10% slowdown in PopFrontGeneric with CopyForwarding and -Ounchecked (the rest are covered by -O) -Ounchecked speedups |_Phonebook_________________|____53.7%_| |_SwiftStructuresTrie_______|____25.4%_| |_ArrayOfGenericRef_________|____25.0%_| |_ArrayOfRef________________|____23.7%_| |_StdlibSort________________|____21.7%_| |_StringWalk________________|____17.9%_| |_JSONHelperDeserialize_____|____14.1%_| |_ArrayOfGenericPOD_________|____12.3%_| |_Havlak____________________|____11.8%_| |_Dictionary2_______________|____11.6%_| |_ArrayOfPOD________________|____11.2%_| |_SortStrings_______________|____10.9%_| |_DollarReduce______________|____10.5%_| |_SwiftStructuresStack______|____10.2%_| |_DollarFilter______________|_____9.5%_| |_StrComplexWalk____________|_____8.6%_| |_DeltaBlue_________________|_____8.5%_| |_StringBuilder_____________|_____7.5%_| |_SwiftStructuresBubbleSort_|_____6.5%_| |_Life______________________|_____6.2%_| |_GenericStack______________|_____6.2%_| |_ArrayLiteral______________|_____6.2%_| |_Histogram_________________|_____6.1%_| |_NSXMLParser_______________|_____5.2%_| |_StrCat____________________|_____5.0%_| Swift SVN r24391