Mercurial > projects > ldc
diff gen/optimizer.cpp @ 129:8096ba7082db trunk
[svn r133] Fixed some problems with inlining not happening :P
Fixed problems with certain cases of deeply nested classes/functions.
author | lindquist |
---|---|
date | Fri, 28 Dec 2007 22:55:24 +0100 |
parents | c42d245468ea |
children | 5825d48b27d1 |
line wrap: on
line diff
--- a/gen/optimizer.cpp Fri Nov 30 17:12:08 2007 +0100 +++ b/gen/optimizer.cpp Fri Dec 28 22:55:24 2007 +0100 @@ -13,8 +13,6 @@ void llvmdc_optimize_module(Module* m, char lvl, bool doinline) { assert(lvl >= 0 && lvl <= 5); - if (lvl == 0) - return; PassManager pm; pm.add(new TargetData(m)); @@ -24,12 +22,12 @@ pm.add(createRaiseAllocationsPass()); pm.add(createCFGSimplificationPass()); pm.add(createPromoteMemoryToRegisterPass()); + pm.add(createGlobalOptimizerPass()); + pm.add(createGlobalDCEPass()); } if (lvl >= 2) { - pm.add(createGlobalOptimizerPass()); - pm.add(createGlobalDCEPass()); pm.add(createIPConstantPropagationPass()); pm.add(createDeadArgEliminationPass()); pm.add(createInstructionCombiningPass()); @@ -77,5 +75,6 @@ // level 4 and 5 are linktime optimizations - pm.run(*m); + if (lvl > 0 || doinline) + pm.run(*m); }