1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 12:41:49 +01:00

Unify XDEBUG and EXPENSIVE_CHECKS (into the latter), and add an option to the cmake build to enable them.

Summary:
Historically, we had a switch in the Makefiles for turning on "expensive
checks". This has never been ported to the cmake build, but the
(dead-ish) code is still around.

This will also make it easier to turn it on in buildbots.

Reviewers: chandlerc

Subscribers: jyknight, mzolotukhin, RKSimon, gberry, llvm-commits

Differential Revision: http://reviews.llvm.org/D19723

llvm-svn: 268050
This commit is contained in:
Filipe Cabecinhas 2016-04-29 15:22:48 +00:00
parent 631087f651
commit c8ae081a57
16 changed files with 26 additions and 19 deletions

View File

@ -304,6 +304,8 @@ else()
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON) option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
endif() endif()
option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING
"Enable abi-breaking checks. Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF.") "Enable abi-breaking checks. Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF.")

View File

@ -44,6 +44,11 @@ if( LLVM_ENABLE_ASSERTIONS )
endif() endif()
endif() endif()
if(LLVM_ENABLE_EXPENSIVE_CHECKS)
add_definitions(-DEXPENSIVE_CHECKS)
add_definitions(-D_GLIBCXX_DEBUG)
endif()
string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS) string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS)
if( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "WITH_ASSERTS" ) if( uppercase_LLVM_ABI_BREAKING_CHECKS STREQUAL "WITH_ASSERTS" )

View File

@ -665,7 +665,7 @@ typename Tr::RegionT *RegionInfoBase<Tr>::createRegion(BlockT *entry,
new RegionT(entry, exit, static_cast<RegionInfoT *>(this), DT); new RegionT(entry, exit, static_cast<RegionInfoT *>(this), DT);
BBtoRegion.insert(std::make_pair(entry, region)); BBtoRegion.insert(std::make_pair(entry, region));
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
region->verifyRegion(); region->verifyRegion();
#else #else
DEBUG(region->verifyRegion()); DEBUG(region->verifyRegion());
@ -764,7 +764,7 @@ void RegionInfoBase<Tr>::buildRegionsTree(DomTreeNodeT *N, RegionT *region) {
} }
} }
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
template <class Tr> template <class Tr>
bool RegionInfoBase<Tr>::VerifyRegionInfo = true; bool RegionInfoBase<Tr>::VerifyRegionInfo = true;
#else #else
@ -798,7 +798,7 @@ void RegionInfoBase<Tr>::releaseMemory() {
template <class Tr> template <class Tr>
void RegionInfoBase<Tr>::verifyAnalysis() const { void RegionInfoBase<Tr>::verifyAnalysis() const {
// Do only verify regions if explicitely activated using XDEBUG or // Do only verify regions if explicitely activated using EXPENSIVE_CHECKS or
// -verify-region-info // -verify-region-info
if (!RegionInfoBase<Tr>::VerifyRegionInfo) if (!RegionInfoBase<Tr>::VerifyRegionInfo)
return; return;

View File

@ -453,7 +453,7 @@ public:
// Compare the result of the tree walk and the dfs numbers, if expensive // Compare the result of the tree walk and the dfs numbers, if expensive
// checks are enabled. // checks are enabled.
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
assert((!DFSInfoValid || assert((!DFSInfoValid ||
(dominatedBySlowTreeWalk(A, B) == B->DominatedBy(A))) && (dominatedBySlowTreeWalk(A, B) == B->DominatedBy(A))) &&
"Tree walk disagrees with dfs numbers!"); "Tree walk disagrees with dfs numbers!");

View File

@ -38,7 +38,7 @@ template class llvm::LoopBase<BasicBlock, Loop>;
template class llvm::LoopInfoBase<BasicBlock, Loop>; template class llvm::LoopInfoBase<BasicBlock, Loop>;
// Always verify loopinfo if expensive checking is enabled. // Always verify loopinfo if expensive checking is enabled.
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
static bool VerifyLoopInfo = true; static bool VerifyLoopInfo = true;
#else #else
static bool VerifyLoopInfo = false; static bool VerifyLoopInfo = false;

View File

@ -111,7 +111,7 @@ MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden,
"derived loop"), "derived loop"),
cl::init(100)); cl::init(100));
// FIXME: Enable this with XDEBUG when the test suite is clean. // FIXME: Enable this with EXPENSIVE_CHECKS when the test suite is clean.
static cl::opt<bool> static cl::opt<bool>
VerifySCEV("verify-scev", VerifySCEV("verify-scev",
cl::desc("Verify ScalarEvolution's backedge taken counts (slow)")); cl::desc("Verify ScalarEvolution's backedge taken counts (slow)"));

View File

@ -204,7 +204,7 @@ bool DAGTypeLegalizer::run() {
// Now that we have a set of nodes to process, handle them all. // Now that we have a set of nodes to process, handle them all.
while (!Worklist.empty()) { while (!Worklist.empty()) {
#ifndef XDEBUG #ifndef EXPENSIVE_CHECKS
if (EnableExpensiveChecks) if (EnableExpensiveChecks)
#endif #endif
PerformExpensiveChecks(); PerformExpensiveChecks();
@ -394,7 +394,7 @@ NodeDone:
} }
} }
#ifndef XDEBUG #ifndef EXPENSIVE_CHECKS
if (EnableExpensiveChecks) if (EnableExpensiveChecks)
#endif #endif
PerformExpensiveChecks(); PerformExpensiveChecks();

View File

@ -7294,9 +7294,9 @@ void llvm::checkForCycles(const llvm::SDNode *N,
bool force) { bool force) {
#ifndef NDEBUG #ifndef NDEBUG
bool check = force; bool check = force;
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
check = true; check = true;
#endif // XDEBUG #endif // EXPENSIVE_CHECKS
if (check) { if (check) {
assert(N && "Checking nonexistent SDNode"); assert(N && "Checking nonexistent SDNode");
SmallPtrSet<const SDNode*, 32> visited; SmallPtrSet<const SDNode*, 32> visited;

View File

@ -28,7 +28,7 @@
using namespace llvm; using namespace llvm;
// Always verify dominfo if expensive checking is enabled. // Always verify dominfo if expensive checking is enabled.
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
static bool VerifyDomInfo = true; static bool VerifyDomInfo = true;
#else #else
static bool VerifyDomInfo = false; static bool VerifyDomInfo = false;

View File

@ -2155,7 +2155,7 @@ void ARMFrameLowering::adjustForSegmentedStacks(
PrevStackMBB->addSuccessor(McrMBB); PrevStackMBB->addSuccessor(McrMBB);
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
MF.verify(); MF.verify();
#endif #endif
} }

View File

@ -1298,7 +1298,7 @@ bool HexagonCommonGEP::runOnFunction(Function &F) {
materialize(Loc); materialize(Loc);
removeDeadCode(); removeDeadCode();
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
// Run this only when expensive checks are enabled. // Run this only when expensive checks are enabled.
verifyFunction(F); verifyFunction(F);
#endif #endif

View File

@ -350,7 +350,7 @@ void SparcFrameLowering::remapRegsForLeafProc(MachineFunction &MF) const {
} }
assert(verifyLeafProcRegUse(&MRI)); assert(verifyLeafProcRegUse(&MRI));
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
MF.verify(0, "After LeafProc Remapping"); MF.verify(0, "After LeafProc Remapping");
#endif #endif
} }

View File

@ -2279,7 +2279,7 @@ void X86FrameLowering::adjustForSegmentedStacks(
checkMBB->addSuccessor(allocMBB); checkMBB->addSuccessor(allocMBB);
checkMBB->addSuccessor(&PrologueMBB); checkMBB->addSuccessor(&PrologueMBB);
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
MF.verify(); MF.verify();
#endif #endif
} }
@ -2423,7 +2423,7 @@ void X86FrameLowering::adjustForHiPEPrologue(
incStackMBB->addSuccessor(&PrologueMBB, {99, 100}); incStackMBB->addSuccessor(&PrologueMBB, {99, 100});
incStackMBB->addSuccessor(incStackMBB, {1, 100}); incStackMBB->addSuccessor(incStackMBB, {1, 100});
} }
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
MF.verify(); MF.verify();
#endif #endif
} }

View File

@ -31,7 +31,7 @@ public:
const_iterator begin() const { return Vector.begin(); } const_iterator begin() const { return Vector.begin(); }
const_iterator end() const { return Vector.end(); } const_iterator end() const { return Vector.end(); }
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
~BlotMapVector() { ~BlotMapVector() {
assert(Vector.size() >= Map.size()); // May differ due to blotting. assert(Vector.size() >= Map.size()); // May differ due to blotting.
for (typename MapTy::const_iterator I = Map.begin(), E = Map.end(); I != E; for (typename MapTy::const_iterator I = Map.begin(), E = Map.end(); I != E;

View File

@ -62,7 +62,7 @@ static cl::opt<unsigned>
RematerializationThreshold("spp-rematerialization-threshold", cl::Hidden, RematerializationThreshold("spp-rematerialization-threshold", cl::Hidden,
cl::init(6)); cl::init(6));
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
static bool ClobberNonLive = true; static bool ClobberNonLive = true;
#else #else
static bool ClobberNonLive = false; static bool ClobberNonLive = false;

View File

@ -805,7 +805,7 @@ void CachingMemorySSAWalker::invalidateInfo(MemoryAccess *MA) {
CachedUpwardsClobberingAccess.clear(); CachedUpwardsClobberingAccess.clear();
} }
#ifdef XDEBUG #ifdef EXPENSIVE_CHECKS
// Run this only when expensive checks are enabled. // Run this only when expensive checks are enabled.
verifyRemoved(MA); verifyRemoved(MA);
#endif #endif