summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/Passes.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-06-15 18:44:27 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-06-15 18:44:27 +0000
commit69fad0799e243f0df832f9b4a98cd74263d8d107 (patch)
tree25553a6a6a043b9ee7627ad77846613be2afe65b /llvm/lib/CodeGen/Passes.cpp
parent6b34a462983498c71fd6fb839ecd0e49e56de4ce (diff)
downloadbcm5719-llvm-69fad0799e243f0df832f9b4a98cd74263d8d107.tar.gz
bcm5719-llvm-69fad0799e243f0df832f9b4a98cd74263d8d107.zip
[CodeGen] Add a pass to fold null checks into nearby memory operations.
Summary: This change adds an "ImplicitNullChecks" target dependent pass. This pass folds null checks into memory operation using the FAULTING_LOAD pseudo-op introduced in previous patches. Depends on D10197 Depends on D10199 Depends on D10200 Reviewers: reames, rnk, pgavlin, JosephTremoulet, atrick Reviewed By: atrick Subscribers: ab, JosephTremoulet, llvm-commits Differential Revision: http://reviews.llvm.org/D10201 llvm-svn: 239743
Diffstat (limited to 'llvm/lib/CodeGen/Passes.cpp')
-rw-r--r--llvm/lib/CodeGen/Passes.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/Passes.cpp b/llvm/lib/CodeGen/Passes.cpp
index 4cd86e66c0e..59b96eb37e7 100644
--- a/llvm/lib/CodeGen/Passes.cpp
+++ b/llvm/lib/CodeGen/Passes.cpp
@@ -72,6 +72,10 @@ static cl::opt<bool> DisableCopyProp("disable-copyprop", cl::Hidden,
cl::desc("Disable Copy Propagation pass"));
static cl::opt<bool> DisablePartialLibcallInlining("disable-partial-libcall-inlining",
cl::Hidden, cl::desc("Disable Partial Libcall Inlining"));
+static cl::opt<bool> EnableImplicitNullChecks(
+ "enable-implicit-null-checks",
+ cl::desc("Fold null checks into faulting memory operations"),
+ cl::init(false));
static cl::opt<bool> PrintLSR("print-lsr-output", cl::Hidden,
cl::desc("Print LLVM IR produced by the loop-reduce pass"));
static cl::opt<bool> PrintISelInput("print-isel-input", cl::Hidden,
@@ -543,6 +547,9 @@ void TargetPassConfig::addMachinePasses() {
// Run pre-sched2 passes.
addPreSched2();
+ if (EnableImplicitNullChecks)
+ addPass(&ImplicitNullChecksID);
+
// Second pass scheduler.
if (getOptLevel() != CodeGenOpt::None) {
if (MISchedPostRA)
OpenPOWER on IntegriCloud