Do global dead code elimination early in optimization.

This gives a 15-20% speedup in compilation time for simple
programs (but only ~2% for the big 21k monster program).
This commit is contained in:
Matt Pharr
2012-05-05 15:13:11 -07:00
parent 8006589828
commit ee7e367981
2 changed files with 257 additions and 3 deletions

View File

@@ -446,6 +446,7 @@ Optimize(llvm::Module *module, int optLevel) {
llvm::initializeTarget(*registry);
bool runSROA = true;
optPM.add(llvm::createGlobalDCEPass());
// Early optimizations to try to reduce the total amount of code to
// work with if we can
@@ -3906,6 +3907,7 @@ MakeInternalFuncsStaticPass::runOnModule(llvm::Module &module) {
"__scatter32_i32", "__scatter32_i64",
"__scatter64_i8", "__scatter64_i16",
"__scatter64_i32", "__scatter64_i64",
"__keep_funcs_live",
};
bool modifiedAny = false;