aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-11-01 19:09:12 +0000
committerChris Lattner <sabre@nondot.org>2009-11-01 19:09:12 +0000
commitc92712184faf007afa28503da77e9a962dceb8cc (patch)
tree309be57398cfef6ea5238a0611ca6263adb058f2 /include
parentec4c7b976645cc49ccfe8dc1c3bfc31ec5fedc62 (diff)
downloadexternal_llvm-c92712184faf007afa28503da77e9a962dceb8cc.zip
external_llvm-c92712184faf007afa28503da77e9a962dceb8cc.tar.gz
external_llvm-c92712184faf007afa28503da77e9a962dceb8cc.tar.bz2
only run GlobalDCE at -O3 and run it late instead of early.
GlobalOpt already deletes trivially dead functions/globals, so GlobalDCE only adds values for cycles of dead things. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85731 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Support/StandardPasses.h13
1 files changed, 9 insertions, 4 deletions
diff --git a/include/llvm/Support/StandardPasses.h b/include/llvm/Support/StandardPasses.h
index d7a3dc0..ff0a6d6 100644
--- a/include/llvm/Support/StandardPasses.h
+++ b/include/llvm/Support/StandardPasses.h
@@ -99,7 +99,7 @@ namespace llvm {
PM->add(createCFGSimplificationPass()); // Clean up disgusting code
if (UnitAtATime) {
PM->add(createGlobalOptimizerPass()); // Optimize out global vars
- PM->add(createGlobalDCEPass()); // Remove unused fns and globs
+
PM->add(createIPSCCPPass()); // IP SCCP
PM->add(createDeadArgEliminationPass()); // Dead argument elimination
}
@@ -149,10 +149,15 @@ namespace llvm {
if (UnitAtATime) {
PM->add(createStripDeadPrototypesPass()); // Get rid of dead prototypes
PM->add(createDeadTypeEliminationPass()); // Eliminate dead types
- }
- if (OptimizationLevel > 1 && UnitAtATime)
- PM->add(createConstantMergePass()); // Merge dup global constants
+ // GlobalOpt already deletes dead functions and globals, at -O3 try a
+ // late pass of GlobalDCE. It is capable of deleting dead cycles.
+ if (OptimizationLevel > 2)
+ PM->add(createGlobalDCEPass()); // Remove dead fns and globals.
+
+ if (OptimizationLevel > 1)
+ PM->add(createConstantMergePass()); // Merge dup global constants
+ }
}
static inline void addOnePass(PassManager *PM, Pass *P, bool AndVerify) {