[llvm-commits] [llvm] r116732 - in /llvm/trunk: include/llvm/Support/StandardPasses.h lib/CodeGen/LLVMTargetMachine.cpp
Dan Gohman
gohman at apple.com
Mon Oct 18 11:50:27 PDT 2010
Author: djg
Date: Mon Oct 18 13:50:27 2010
New Revision: 116732
URL: http://llvm.org/viewvc/llvm-project?rev=116732&view=rev
Log:
Add TypeBasedAliasAnalysis to the standard pass lists. Note that it
is currently inert by default.
Modified:
llvm/trunk/include/llvm/Support/StandardPasses.h
llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
Modified: llvm/trunk/include/llvm/Support/StandardPasses.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/StandardPasses.h?rev=116732&r1=116731&r2=116732&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/StandardPasses.h (original)
+++ llvm/trunk/include/llvm/Support/StandardPasses.h Mon Oct 18 13:50:27 2010
@@ -69,10 +69,18 @@
// Implementations
+ static inline void createStandardAliasAnalysisPasses(PassManagerBase *PM) {
+ // Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
+ // BasicAliasAnalysis wins if they disagree. This is intended to help
+ // support "obvious" type-punning idioms.
+ PM->add(createTypeBasedAliasAnalysisPass());
+ PM->add(createBasicAliasAnalysisPass());
+ }
+
static inline void createStandardFunctionPasses(PassManagerBase *PM,
unsigned OptimizationLevel) {
if (OptimizationLevel > 0) {
- PM->add(createBasicAliasAnalysisPass());
+ createStandardAliasAnalysisPasses(PM);
PM->add(createCFGSimplificationPass());
if (OptimizationLevel == 1)
PM->add(createPromoteMemoryToRegisterPass());
@@ -92,7 +100,7 @@
bool SimplifyLibCalls,
bool HaveExceptions,
Pass *InliningPass) {
- PM->add(createBasicAliasAnalysisPass());
+ createStandardAliasAnalysisPasses(PM);
if (OptimizationLevel == 0) {
if (InliningPass)
@@ -181,7 +189,7 @@
bool RunInliner,
bool VerifyEach) {
// Provide AliasAnalysis services for optimizations.
- PM->add(createBasicAliasAnalysisPass());
+ createStandardAliasAnalysisPasses(PM);
// Now that composite has been compiled, scan through the module, looking
// for a main function. If main is defined, mark all other functions
Modified: llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp?rev=116732&r1=116731&r2=116732&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp (original)
+++ llvm/trunk/lib/CodeGen/LLVMTargetMachine.cpp Mon Oct 18 13:50:27 2010
@@ -14,7 +14,6 @@
#include "llvm/Target/TargetMachine.h"
#include "llvm/PassManager.h"
#include "llvm/Analysis/Verifier.h"
-#include "llvm/Analysis/Passes.h"
#include "llvm/Assembly/PrintModulePass.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFunctionAnalysis.h"
@@ -31,6 +30,7 @@
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/FormattedStream.h"
+#include "llvm/Support/StandardPasses.h"
using namespace llvm;
namespace llvm {
@@ -256,7 +256,7 @@
// Standard LLVM-Level Passes.
// Basic AliasAnalysis support.
- PM.add(createBasicAliasAnalysisPass());
+ createStandardAliasAnalysisPasses(&PM);
// Before running any passes, run the verifier to determine if the input
// coming from the front-end and/or optimizer is valid.
More information about the llvm-commits
mailing list