[PATCH] D44464: OptBisect is improved to be overridden in LLVMContext
Yevgeny Rouban via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 14 09:03:16 PDT 2018
yrouban updated this revision to Diff 138384.
yrouban added a comment.
fixed according to all Eugene's comments
https://reviews.llvm.org/D44464
Files:
include/llvm/IR/LLVMContext.h
include/llvm/IR/OptBisect.h
lib/IR/LLVMContext.cpp
lib/IR/LLVMContextImpl.cpp
lib/IR/LLVMContextImpl.h
Index: lib/IR/LLVMContextImpl.h
===================================================================
--- lib/IR/LLVMContextImpl.h
+++ lib/IR/LLVMContextImpl.h
@@ -1355,9 +1355,15 @@
/// Destroy the ConstantArrays if they are not used.
void dropTriviallyDeadConstantArrays();
+ OptBisect *OptBisector = nullptr;
+
/// \brief Access the object which manages optimization bisection for failure
/// analysis.
OptBisect &getOptBisect();
+
+ /// \brief Set the object which manages optimization bisection for failure
+ /// analysis.
+ void setOptBisect(OptBisect&);
};
} // end namespace llvm
Index: lib/IR/LLVMContextImpl.cpp
===================================================================
--- lib/IR/LLVMContextImpl.cpp
+++ lib/IR/LLVMContextImpl.cpp
@@ -234,5 +234,11 @@
static ManagedStatic<OptBisect> OptBisector;
OptBisect &LLVMContextImpl::getOptBisect() {
+ if (!OptBisector)
+ OptBisector = &(*::OptBisector);
return *OptBisector;
}
+
+void LLVMContextImpl::setOptBisect(OptBisect& OB) {
+ OptBisector = &OB;
+}
Index: lib/IR/LLVMContext.cpp
===================================================================
--- lib/IR/LLVMContext.cpp
+++ lib/IR/LLVMContext.cpp
@@ -336,6 +336,10 @@
return pImpl->getOptBisect();
}
+void LLVMContext::setOptBisect(OptBisect& OB) {
+ pImpl->setOptBisect(OB);
+}
+
const DiagnosticHandler *LLVMContext::getDiagHandlerPtr() const {
return pImpl->DiagHandler.get();
}
Index: include/llvm/IR/OptBisect.h
===================================================================
--- include/llvm/IR/OptBisect.h
+++ include/llvm/IR/OptBisect.h
@@ -36,6 +36,8 @@
/// through LLVMContext.
OptBisect();
+ virtual ~OptBisect() = default;
+
/// Checks the bisect limit to determine if the specified pass should run.
///
/// This function will immediate return true if bisection is disabled. If the
@@ -51,8 +53,8 @@
template <class UnitT>
bool shouldRunPass(const Pass *P, const UnitT &U);
-private:
- bool checkPass(const StringRef PassName, const StringRef TargetDesc);
+protected:
+ virtual bool checkPass(const StringRef PassName, const StringRef TargetDesc);
bool BisectEnabled = false;
unsigned LastBisectNum = 0;
Index: include/llvm/IR/LLVMContext.h
===================================================================
--- include/llvm/IR/LLVMContext.h
+++ include/llvm/IR/LLVMContext.h
@@ -318,6 +318,11 @@
/// \brief Access the object which manages optimization bisection for failure
/// analysis.
OptBisect &getOptBisect();
+
+ /// \brief Set the object which manages optimization bisection for failure
+ /// analysis.
+ void setOptBisect(OptBisect&);
+
private:
// Module needs access to the add/removeModule methods.
friend class Module;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44464.138384.patch
Type: text/x-patch
Size: 2777 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180314/86235e0e/attachment.bin>
More information about the llvm-commits
mailing list