diff options
author | Andrew Kaylor <andrew.kaylor@intel.com> | 2016-04-21 17:58:54 +0000 |
---|---|---|
committer | Andrew Kaylor <andrew.kaylor@intel.com> | 2016-04-21 17:58:54 +0000 |
commit | f0f279291c7ca1a0b2c125f53cd08deafcc9e44f (patch) | |
tree | 8dc9d85bccec5a6d1fea7ede32e6e92d3161a875 /llvm/lib/IR/LLVMContextImpl.cpp | |
parent | 97788020c59f9c2c8a9ac99d3fc87f5f5a7cda80 (diff) | |
download | llvm-f0f279291c7ca1a0b2c125f53cd08deafcc9e44f.zip llvm-f0f279291c7ca1a0b2c125f53cd08deafcc9e44f.tar.gz llvm-f0f279291c7ca1a0b2c125f53cd08deafcc9e44f.tar.bz2 |
Initial implementation of optimization bisect support.
This patch implements a optimization bisect feature, which will allow optimizations to be selectively disabled at compile time in order to track down test failures that are caused by incorrect optimizations.
The bisection is enabled using a new command line option (-opt-bisect-limit). Individual passes that may be skipped call the OptBisect object (via an LLVMContext) to see if they should be skipped based on the bisect limit. A finer level of control (disabling individual transformations) can be managed through an addition OptBisect method, but this is not yet used.
The skip checking in this implementation is based on (and replaces) the skipOptnoneFunction check. Where that check was being called, a new call has been inserted in its place which checks the bisect limit and the optnone attribute. A new function call has been added for module and SCC passes that behaves in a similar way.
Differential Revision: http://reviews.llvm.org/D19172
llvm-svn: 267022
Diffstat (limited to 'llvm/lib/IR/LLVMContextImpl.cpp')
-rw-r--r-- | llvm/lib/IR/LLVMContextImpl.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp index d5d9038..d27fcb1 100644 --- a/llvm/lib/IR/LLVMContextImpl.cpp +++ b/llvm/lib/IR/LLVMContextImpl.cpp @@ -16,6 +16,8 @@ #include "llvm/IR/Attributes.h" #include "llvm/IR/DiagnosticInfo.h" #include "llvm/IR/Module.h" +#include "llvm/IR/OptBisect.h" +#include "llvm/Support/ManagedStatic.h" #include <algorithm> using namespace llvm; @@ -232,3 +234,19 @@ void GetElementPtrConstantExpr::anchor() { } void CompareConstantExpr::anchor() { } +/// Singleton instance of the OptBisect class. +/// +/// This singleton is accessed via the LLVMContext::getOptBisect() function. It +/// provides a mechanism to disable passes and individual optimizations at +/// compile time based on a command line option (-opt-bisect-limit) in order to +/// perform a bisecting search for optimization-related problems. +/// +/// Even if multiple LLVMContext objects are created, they will all return the +/// same instance of OptBisect in order to provide a single bisect count. Any +/// code that uses the OptBisect object should be serialized when bisection is +/// enabled in order to enable a consistent bisect count. +static ManagedStatic<OptBisect> OptBisector; + +OptBisect &LLVMContextImpl::getOptBisect() { + return *OptBisector; +} |