Add private to local to optimization and size passes.

Many optimization will run on function scope symbols only.  When symbols
are moved from private scope to function scople, then these optimizations
can do more.

I believe it is a good idea to run this pass with both -O and -Os.  To
get the most out of it it should be run ASAP after inlining and something
that remove all of the dead functions.
This commit is contained in:
Steven Perron 2018-07-04 15:26:32 -04:00
parent 4926f295b1
commit 101a9bcbb0

View File

@ -140,6 +140,7 @@ Optimizer& Optimizer::RegisterPerformancePasses() {
return RegisterPass(CreateMergeReturnPass())
.RegisterPass(CreateInlineExhaustivePass())
.RegisterPass(CreateAggressiveDCEPass())
.RegisterPass(CreatePrivateToLocalPass())
.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass())
.RegisterPass(CreateLocalSingleStoreElimPass())
.RegisterPass(CreateAggressiveDCEPass())
@ -175,6 +176,7 @@ Optimizer& Optimizer::RegisterSizePasses() {
return RegisterPass(CreateMergeReturnPass())
.RegisterPass(CreateInlineExhaustivePass())
.RegisterPass(CreateAggressiveDCEPass())
.RegisterPass(CreatePrivateToLocalPass())
.RegisterPass(CreateScalarReplacementPass())
.RegisterPass(CreateLocalAccessChainConvertPass())
.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass())