Commit a96bd04f authored by Kevin Modzelewski's avatar Kevin Modzelewski

Reduce number of optimization passes we run

The previous set was based on trying to get the absolute
best results on microbenchmarks; go back to the small set.
parent 8728a053
...@@ -513,6 +513,8 @@ void initCodegen() { ...@@ -513,6 +513,8 @@ void initCodegen() {
// llvm_args.push_back("--debug-only=stackmaps"); // llvm_args.push_back("--debug-only=stackmaps");
#endif #endif
// llvm_args.push_back("--time-passes");
// llvm_args.push_back("--print-after-all"); // llvm_args.push_back("--print-after-all");
// llvm_args.push_back("--print-machineinstrs"); // llvm_args.push_back("--print-machineinstrs");
if (USE_REGALLOC_BASIC) if (USE_REGALLOC_BASIC)
......
...@@ -108,20 +108,27 @@ static void optimizeIR(llvm::Function* f, EffortLevel effort) { ...@@ -108,20 +108,27 @@ static void optimizeIR(llvm::Function* f, EffortLevel effort) {
if (ENABLE_PYSTON_PASSES) if (ENABLE_PYSTON_PASSES)
fpm.add(createMallocsNonNullPass()); fpm.add(createMallocsNonNullPass());
// TODO Find the right place for this pass (and ideally not duplicate it)
if (ENABLE_PYSTON_PASSES) {
fpm.add(llvm::createGVNPass());
fpm.add(createConstClassesPass());
}
// TODO: find the right set of passes // TODO: find the right set of passes
if (0) { if (1) {
// My original set of passes, that seem to get about 90% of the benefit: // Small set of passes:
fpm.add(llvm::createInstructionCombiningPass()); fpm.add(llvm::createInstructionCombiningPass());
fpm.add(llvm::createReassociatePass()); fpm.add(llvm::createReassociatePass());
fpm.add(llvm::createGVNPass()); fpm.add(llvm::createGVNPass());
fpm.add(llvm::createCFGSimplificationPass()); fpm.add(llvm::createCFGSimplificationPass());
if (ENABLE_PYSTON_PASSES) {
fpm.add(createConstClassesPass());
fpm.add(createDeadAllocsPass());
fpm.add(llvm::createInstructionCombiningPass());
fpm.add(llvm::createCFGSimplificationPass());
}
} else { } else {
// TODO Find the right place for this pass (and ideally not duplicate it)
if (ENABLE_PYSTON_PASSES) {
fpm.add(llvm::createGVNPass());
fpm.add(createConstClassesPass());
}
// copied + slightly modified from llvm/lib/Transforms/IPO/PassManagerBuilder.cpp::populateModulePassManager // copied + slightly modified from llvm/lib/Transforms/IPO/PassManagerBuilder.cpp::populateModulePassManager
fpm.add(llvm::createEarlyCSEPass()); // Catch trivial redundancies fpm.add(llvm::createEarlyCSEPass()); // Catch trivial redundancies
fpm.add(llvm::createJumpThreadingPass()); // Thread jumps. fpm.add(llvm::createJumpThreadingPass()); // Thread jumps.
...@@ -165,19 +172,19 @@ static void optimizeIR(llvm::Function* f, EffortLevel effort) { ...@@ -165,19 +172,19 @@ static void optimizeIR(llvm::Function* f, EffortLevel effort) {
// fpm.add(llvm::createLoopVectorizePass(DisableUnrollLoops, LoopVectorize)); // fpm.add(llvm::createLoopVectorizePass(DisableUnrollLoops, LoopVectorize));
fpm.add(llvm::createInstructionCombiningPass()); fpm.add(llvm::createInstructionCombiningPass());
fpm.add(llvm::createCFGSimplificationPass()); fpm.add(llvm::createCFGSimplificationPass());
}
// TODO Find the right place for this pass (and ideally not duplicate it) // TODO Find the right place for this pass (and ideally not duplicate it)
if (ENABLE_PYSTON_PASSES) { if (ENABLE_PYSTON_PASSES) {
fpm.add(createConstClassesPass()); fpm.add(createConstClassesPass());
fpm.add(llvm::createInstructionCombiningPass()); fpm.add(llvm::createInstructionCombiningPass());
fpm.add(llvm::createCFGSimplificationPass()); fpm.add(llvm::createCFGSimplificationPass());
fpm.add(createConstClassesPass()); fpm.add(createConstClassesPass());
fpm.add(createDeadAllocsPass()); fpm.add(createDeadAllocsPass());
// fpm.add(llvm::createSCCPPass()); // Constant prop with SCCP // fpm.add(llvm::createSCCPPass()); // Constant prop with SCCP
// fpm.add(llvm::createEarlyCSEPass()); // Catch trivial redundancies // fpm.add(llvm::createEarlyCSEPass()); // Catch trivial redundancies
// fpm.add(llvm::createInstructionCombiningPass()); // fpm.add(llvm::createInstructionCombiningPass());
// fpm.add(llvm::createCFGSimplificationPass()); // fpm.add(llvm::createCFGSimplificationPass());
}
} }
fpm.doInitialization(); fpm.doInitialization();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment