GlobalDCE should be run at -O2 / -Os to eliminate unused dtor, etc. rdar://9142819

llvm-svn: 164850
This commit is contained in:
Evan Cheng 2012-09-28 21:23:26 +00:00
parent 30420f3184
commit 69a822b612

View File

@ -211,13 +211,12 @@ void PassManagerBuilder::populateModulePassManager(PassManagerBase &MPM) {
// FIXME: We shouldn't bother with this anymore.
MPM.add(createStripDeadPrototypesPass()); // Get rid of dead prototypes
// GlobalOpt already deletes dead functions and globals, at -O3 try a
// GlobalOpt already deletes dead functions and globals, at -O2 try a
// late pass of GlobalDCE. It is capable of deleting dead cycles.
if (OptLevel > 2)
if (OptLevel > 1) {
MPM.add(createGlobalDCEPass()); // Remove dead fns and globals.
if (OptLevel > 1)
MPM.add(createConstantMergePass()); // Merge dup global constants
}
}
addExtensionsToPM(EP_OptimizerLast, MPM);
}