Adding additional functionality to ADCE.

Modified ADCE to remove dead globals.
* Entry point and execution mode instructions are marked as alive
* Reachable functions and their parameters are marked as alive
* Instruction deletion now deferred until the end of the pass
* Eliminated dead insts set, added IsDead to calculate that value
instead
* Ported applicable dead variable elimination tests
* Ported dead constant elim tests

Added dead function elimination to ADCE
* ported dead function elim tests

Added handling of decoration groups in ADCE
* Uses a custom sorter to traverse decorations in a specific order
* Simplifies necessary checks

Updated -O and -Os pass lists.
This commit is contained in:
Alan Baker
2017-12-18 12:13:10 -05:00
parent d54a286c75
commit 3a054e1ddc
6 changed files with 1940 additions and 260 deletions
+4 -4
View File
@@ -118,7 +118,7 @@ Optimizer& Optimizer::RegisterPerformancePasses() {
return RegisterPass(CreateRemoveDuplicatesPass())
.RegisterPass(CreateMergeReturnPass())
.RegisterPass(CreateInlineExhaustivePass())
.RegisterPass(CreateEliminateDeadFunctionsPass())
.RegisterPass(CreateAggressiveDCEPass())
.RegisterPass(CreateScalarReplacementPass())
.RegisterPass(CreateLocalAccessChainConvertPass())
.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass())
@@ -134,14 +134,14 @@ Optimizer& Optimizer::RegisterPerformancePasses() {
.RegisterPass(CreateCFGCleanupPass())
// Currently exposing driver bugs resulting in crashes (#946)
// .RegisterPass(CreateCommonUniformElimPass())
.RegisterPass(CreateDeadVariableEliminationPass());
.RegisterPass(CreateAggressiveDCEPass());
}
Optimizer& Optimizer::RegisterSizePasses() {
return RegisterPass(CreateRemoveDuplicatesPass())
.RegisterPass(CreateMergeReturnPass())
.RegisterPass(CreateInlineExhaustivePass())
.RegisterPass(CreateEliminateDeadFunctionsPass())
.RegisterPass(CreateAggressiveDCEPass())
.RegisterPass(CreateLocalAccessChainConvertPass())
.RegisterPass(CreateLocalSingleBlockLoadStoreElimPass())
.RegisterPass(CreateLocalSingleStoreElimPass())
@@ -156,7 +156,7 @@ Optimizer& Optimizer::RegisterSizePasses() {
.RegisterPass(CreateCFGCleanupPass())
// Currently exposing driver bugs resulting in crashes (#946)
// .RegisterPass(CreateCommonUniformElimPass())
.RegisterPass(CreateDeadVariableEliminationPass());
.RegisterPass(CreateAggressiveDCEPass());
}
bool Optimizer::Run(const uint32_t* original_binary,