aboutsummaryrefslogtreecommitdiffstats
path: root/tools/gccld/GenerateCode.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-07-27 08:13:15 +0000
committerChris Lattner <sabre@nondot.org>2004-07-27 08:13:15 +0000
commit2d26ffb6791978f23ffa2d81a84f6478ee016cd8 (patch)
tree3402e6f2f20773dd8105d5fe9d46693eb56d2c1b /tools/gccld/GenerateCode.cpp
parentb0015c510f08c7de6ab553419e2b0615f5bdf577 (diff)
downloadexternal_llvm-2d26ffb6791978f23ffa2d81a84f6478ee016cd8.zip
external_llvm-2d26ffb6791978f23ffa2d81a84f6478ee016cd8.tar.gz
external_llvm-2d26ffb6791978f23ffa2d81a84f6478ee016cd8.tar.bz2
Run DSE at link-time, and turn on an IP alias analysis by default in gccld!
The -disable-globalsmodref is temporary and will be removed eventually. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15268 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/gccld/GenerateCode.cpp')
-rw-r--r--tools/gccld/GenerateCode.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/gccld/GenerateCode.cpp b/tools/gccld/GenerateCode.cpp
index d186f74..74576bb 100644
--- a/tools/gccld/GenerateCode.cpp
+++ b/tools/gccld/GenerateCode.cpp
@@ -17,6 +17,7 @@
#include "llvm/Module.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/LoadValueNumbering.h"
+#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/Verifier.h"
#include "llvm/Bytecode/WriteBytecodePass.h"
#include "llvm/Target/TargetData.h"
@@ -37,6 +38,9 @@ namespace {
cl::opt<bool>
DisableOptimizations("disable-opt",
cl::desc("Do not run any optimization passes"));
+ cl::opt<bool>
+ DisableGlobalsModRef("disable-globalsmodref", cl::Hidden,
+ cl::desc("Turn on the more aggressive alias analysis"));
}
/// CopyEnv - This function takes an array of environment variables and makes a
@@ -196,11 +200,13 @@ int llvm::GenerateBytecode(Module *M, bool Strip, bool Internalize,
addPass(Passes, createScalarReplAggregatesPass()); // Break up allocas
// Run a few AA driven optimizations here and now, to cleanup the code.
- // Eventually we should put an IP AA in place here.
+ if (!DisableGlobalsModRef)
+ addPass(Passes, createGlobalsModRefPass()); // IP alias analysis
addPass(Passes, createLICMPass()); // Hoist loop invariants
addPass(Passes, createLoadValueNumberingPass()); // GVN for load instrs
addPass(Passes, createGCSEPass()); // Remove common subexprs
+ addPass(Passes, createDeadStoreEliminationPass()); // Nuke dead stores
// Cleanup and simplify the code after the scalar optimizations.
addPass(Passes, createInstructionCombiningPass());