summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorGeorge Burgess IV <george.burgess.iv@gmail.com>2016-07-06 00:26:41 +0000
committerGeorge Burgess IV <george.burgess.iv@gmail.com>2016-07-06 00:26:41 +0000
commitbfa401e5ad960ad1fff0569c9189c7df2b6df5c3 (patch)
treef3a6a53e4d6784c8c8dd62eeb163db5a64e794fc /llvm/lib/Transforms
parent69898e6bc59cebafb877ffa306f4876e066359aa (diff)
downloadbcm5719-llvm-bfa401e5ad960ad1fff0569c9189c7df2b6df5c3.tar.gz
bcm5719-llvm-bfa401e5ad960ad1fff0569c9189c7df2b6df5c3.zip
[CFLAA] Split into Anders+Steens analysis.
StratifiedSets (as implemented) is very fast, but its accuracy is also limited. If we take a more aggressive andersens-like approach, we can be way more accurate, but we'll also end up being slower. So, we've decided to split CFLAA into CFLSteensAA and CFLAndersAA. Long-term, we want to end up in a place where CFLSteens is queried first; if it can provide an answer, great (since queries are basically map lookups). Otherwise, we'll fall back to CFLAnders, BasicAA, etc. This patch splits everything out so we can try to do something like that when we get a reasonable CFLAnders implementation. Patch by Jia Chen. Differential Revision: http://reviews.llvm.org/D21910 llvm-svn: 274589
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/IPO/PassManagerBuilder.cpp36
1 files changed, 30 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
index 2a209b34ccf..e283d26f5c1 100644
--- a/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
+++ b/llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
@@ -16,7 +16,8 @@
#include "llvm-c/Transforms/PassManagerBuilder.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/BasicAliasAnalysis.h"
-#include "llvm/Analysis/CFLAliasAnalysis.h"
+#include "llvm/Analysis/CFLAndersAliasAnalysis.h"
+#include "llvm/Analysis/CFLSteensAliasAnalysis.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/Passes.h"
#include "llvm/Analysis/ScopedNoAliasAA.h"
@@ -79,9 +80,19 @@ RunSLPAfterLoopVectorization("run-slp-after-loop-vectorization",
cl::desc("Run the SLP vectorizer (and BB vectorizer) after the Loop "
"vectorizer instead of before"));
-static cl::opt<bool> UseCFLAA("use-cfl-aa",
- cl::init(false), cl::Hidden,
- cl::desc("Enable the new, experimental CFL alias analysis"));
+// Experimental option to use CFL-AA
+enum class CFLAAType { None, Steensgaard, Andersen, Both };
+static cl::opt<CFLAAType>
+ UseCFLAA("use-cfl-aa", cl::init(CFLAAType::None), cl::Hidden,
+ cl::desc("Enable the new, experimental CFL alias analysis"),
+ cl::values(clEnumValN(CFLAAType::None, "none", "Disable CFL-AA"),
+ clEnumValN(CFLAAType::Steensgaard, "steens",
+ "Enable unification-based CFL-AA"),
+ clEnumValN(CFLAAType::Andersen, "anders",
+ "Enable inclusion-based CFL-AA"),
+ clEnumValN(CFLAAType::Both, "both",
+ "Enable both variants of CFL-aa"),
+ clEnumValEnd));
static cl::opt<bool>
EnableMLSM("mlsm", cl::init(true), cl::Hidden,
@@ -169,11 +180,24 @@ void PassManagerBuilder::addExtensionsToPM(ExtensionPointTy ETy,
void PassManagerBuilder::addInitialAliasAnalysisPasses(
legacy::PassManagerBase &PM) const {
+ switch (UseCFLAA) {
+ case CFLAAType::Steensgaard:
+ PM.add(createCFLSteensAAWrapperPass());
+ break;
+ case CFLAAType::Andersen:
+ PM.add(createCFLAndersAAWrapperPass());
+ break;
+ case CFLAAType::Both:
+ PM.add(createCFLSteensAAWrapperPass());
+ PM.add(createCFLAndersAAWrapperPass());
+ break;
+ default:
+ break;
+ }
+
// Add TypeBasedAliasAnalysis before BasicAliasAnalysis so that
// BasicAliasAnalysis wins if they disagree. This is intended to help
// support "obvious" type-punning idioms.
- if (UseCFLAA)
- PM.add(createCFLAAWrapperPass());
PM.add(createTypeBasedAAWrapperPass());
PM.add(createScopedNoAliasAAWrapperPass());
}
OpenPOWER on IntegriCloud