aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorEvan Cheng <evan.cheng@apple.com>2010-02-06 09:07:11 +0000
committerEvan Cheng <evan.cheng@apple.com>2010-02-06 09:07:11 +0000
commit254de0edb72f9c9e5b16d7b6331593d11157ce3c (patch)
tree9339c885e326a6d881e123500e772ba97e35e9a6 /lib/CodeGen/LLVMTargetMachine.cpp
parent3612d09c93ae9235d9d2d63aaa079221121c8907 (diff)
downloadexternal_llvm-254de0edb72f9c9e5b16d7b6331593d11157ce3c.tar.gz
external_llvm-254de0edb72f9c9e5b16d7b6331593d11157ce3c.tar.bz2
external_llvm-254de0edb72f9c9e5b16d7b6331593d11157ce3c.zip
Run codegen dce pass for all targets at all optimization levels. Previously it's
only run for x86 with fastisel. I've found it being very effective in eliminating some obvious dead code as result of formal parameter lowering especially when tail call optimization eliminated the need for some of the loads from fixed frame objects. It also shrinks a number of the tests. A couple of tests no longer make sense and are now eliminated. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@95493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--lib/CodeGen/LLVMTargetMachine.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/LLVMTargetMachine.cpp b/lib/CodeGen/LLVMTargetMachine.cpp
index c03e4290ca..40e015067f 100644
--- a/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/lib/CodeGen/LLVMTargetMachine.cpp
@@ -291,6 +291,12 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
printAndVerify(PM, "After Instruction Selection",
/* allowDoubleDefs= */ true);
+
+ // Delete dead machine instructions regardless of optimization level.
+ PM.add(createDeadMachineInstructionElimPass());
+ printAndVerify(PM, "After codegen DCE pass",
+ /* allowDoubleDefs= */ true);
+
if (OptLevel != CodeGenOpt::None) {
PM.add(createOptimizeExtsPass());
if (!DisableMachineLICM)