summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/LLVMTargetMachine.cpp
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2009-11-20 02:03:44 +0000
committerDan Gohman <gohman@apple.com>2009-11-20 02:03:44 +0000
commitf4fe57ad90e32a9897125d40be7bd480d6d48279 (patch)
tree230ccfca6033f3913b37e81512c08f0a823dc14d /llvm/lib/CodeGen/LLVMTargetMachine.cpp
parent4d7a07bdaf625e61a94f41b72f79165869ca79d8 (diff)
downloadbcm5719-llvm-f4fe57ad90e32a9897125d40be7bd480d6d48279.tar.gz
bcm5719-llvm-f4fe57ad90e32a9897125d40be7bd480d6d48279.zip
Add an experimental option to run gep-splitting and no-load GVN
just before codegen. llvm-svn: 89439
Diffstat (limited to 'llvm/lib/CodeGen/LLVMTargetMachine.cpp')
-rw-r--r--llvm/lib/CodeGen/LLVMTargetMachine.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/LLVMTargetMachine.cpp b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
index 0db459bb916..8800f22beb5 100644
--- a/llvm/lib/CodeGen/LLVMTargetMachine.cpp
+++ b/llvm/lib/CodeGen/LLVMTargetMachine.cpp
@@ -66,6 +66,11 @@ static cl::opt<cl::boolOrDefault>
EnableFastISelOption("fast-isel", cl::Hidden,
cl::desc("Enable the \"fast\" instruction selector"));
+// Enable or disable an experimental optimization to split GEPs
+// and run a special GVN pass which does not examine loads, in
+// an effort to factor out redundancy implicit in complex GEPs.
+static cl::opt<bool> EnableSplitGEPGVN("split-gep-gvn", cl::Hidden,
+ cl::desc("Split GEPs and run no-load GVN"));
LLVMTargetMachine::LLVMTargetMachine(const Target &T,
const std::string &TargetTriple)
@@ -223,6 +228,12 @@ bool LLVMTargetMachine::addCommonCodeGenPasses(PassManagerBase &PM,
CodeGenOpt::Level OptLevel) {
// Standard LLVM-Level Passes.
+ // Optionally, tun split-GEPs and no-load GVN.
+ if (EnableSplitGEPGVN) {
+ PM.add(createGEPSplitterPass());
+ PM.add(createGVNPass(/*NoPRE=*/false, /*NoLoads=*/true));
+ }
+
// Run loop strength reduction before anything else.
if (OptLevel != CodeGenOpt::None && !DisableLSR) {
PM.add(createLoopStrengthReducePass(getTargetLowering()));
OpenPOWER on IntegriCloud