llvm.org GIT mirror llvm / 2fd5434
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 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@268050 91177308-0d34-0410-b5e6-96231b3b80d8 Filipe Cabecinhas 4 years ago
16 changed file(s) with 26 addition(s) and 19 deletion(s). Raw diff Collapse all Expand all
303303 option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
304304 endif()
305305
306 option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
307
306308 set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING
307309 "Enable abi-breaking checks. Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF.")
308310
4141 "${flags_var_to_scrub}" "${${flags_var_to_scrub}}")
4242 endforeach()
4343 endif()
44 endif()
45
46 if(LLVM_ENABLE_EXPENSIVE_CHECKS)
47 add_definitions(-DEXPENSIVE_CHECKS)
48 add_definitions(-D_GLIBCXX_DEBUG)
4449 endif()
4550
4651 string(TOUPPER "${LLVM_ABI_BREAKING_CHECKS}" uppercase_LLVM_ABI_BREAKING_CHECKS)
::VerifyRegionInfo = true; ::verifyAnalysis() const { ::VerifyRegionInfo)
664664 new RegionT(entry, exit, static_cast(this), DT);
665665 BBtoRegion.insert(std::make_pair(entry, region));
666666
667 #ifdef XDEBUG
667 #ifdef EXPENSIVE_CHECKS
668668 region->verifyRegion();
669669 #else
670670 DEBUG(region->verifyRegion());
763763 }
764764 }
765765
766 #ifdef XDEBUG
766 #ifdef EXPENSIVE_CHECKS
767767 template
768768 bool RegionInfoBase
769769 #else
797797
798798 template
799799 void RegionInfoBase
800 // Do only verify regions if explicitely activated using XDEBUG or
800 // Do only verify regions if explicitely activated using EXPENSIVE_CHECKS or
801801 // -verify-region-info
802802 if (!RegionInfoBase
803803 return;
452452
453453 // Compare the result of the tree walk and the dfs numbers, if expensive
454454 // checks are enabled.
455 #ifdef XDEBUG
455 #ifdef EXPENSIVE_CHECKS
456456 assert((!DFSInfoValid ||
457457 (dominatedBySlowTreeWalk(A, B) == B->DominatedBy(A))) &&
458458 "Tree walk disagrees with dfs numbers!");
3737 template class llvm::LoopInfoBase;
3838
3939 // Always verify loopinfo if expensive checking is enabled.
40 #ifdef XDEBUG
40 #ifdef EXPENSIVE_CHECKS
4141 static bool VerifyLoopInfo = true;
4242 #else
4343 static bool VerifyLoopInfo = false;
110110 "derived loop"),
111111 cl::init(100));
112112
113 // FIXME: Enable this with XDEBUG when the test suite is clean.
113 // FIXME: Enable this with EXPENSIVE_CHECKS when the test suite is clean.
114114 static cl::opt
115115 VerifySCEV("verify-scev",
116116 cl::desc("Verify ScalarEvolution's backedge taken counts (slow)"));
203203
204204 // Now that we have a set of nodes to process, handle them all.
205205 while (!Worklist.empty()) {
206 #ifndef XDEBUG
206 #ifndef EXPENSIVE_CHECKS
207207 if (EnableExpensiveChecks)
208208 #endif
209209 PerformExpensiveChecks();
393393 }
394394 }
395395
396 #ifndef XDEBUG
396 #ifndef EXPENSIVE_CHECKS
397397 if (EnableExpensiveChecks)
398398 #endif
399399 PerformExpensiveChecks();
72937293 bool force) {
72947294 #ifndef NDEBUG
72957295 bool check = force;
7296 #ifdef XDEBUG
7296 #ifdef EXPENSIVE_CHECKS
72977297 check = true;
7298 #endif // XDEBUG
7298 #endif // EXPENSIVE_CHECKS
72997299 if (check) {
73007300 assert(N && "Checking nonexistent SDNode");
73017301 SmallPtrSet visited;
2727 using namespace llvm;
2828
2929 // Always verify dominfo if expensive checking is enabled.
30 #ifdef XDEBUG
30 #ifdef EXPENSIVE_CHECKS
3131 static bool VerifyDomInfo = true;
3232 #else
3333 static bool VerifyDomInfo = false;
21542154
21552155 PrevStackMBB->addSuccessor(McrMBB);
21562156
2157 #ifdef XDEBUG
2157 #ifdef EXPENSIVE_CHECKS
21582158 MF.verify();
21592159 #endif
21602160 }
12971297 materialize(Loc);
12981298 removeDeadCode();
12991299
1300 #ifdef XDEBUG
1300 #ifdef EXPENSIVE_CHECKS
13011301 // Run this only when expensive checks are enabled.
13021302 verifyFunction(F);
13031303 #endif
349349 }
350350
351351 assert(verifyLeafProcRegUse(&MRI));
352 #ifdef XDEBUG
352 #ifdef EXPENSIVE_CHECKS
353353 MF.verify(0, "After LeafProc Remapping");
354354 #endif
355355 }
22782278 checkMBB->addSuccessor(allocMBB);
22792279 checkMBB->addSuccessor(&PrologueMBB);
22802280
2281 #ifdef XDEBUG
2281 #ifdef EXPENSIVE_CHECKS
22822282 MF.verify();
22832283 #endif
22842284 }
24222422 incStackMBB->addSuccessor(&PrologueMBB, {99, 100});
24232423 incStackMBB->addSuccessor(incStackMBB, {1, 100});
24242424 }
2425 #ifdef XDEBUG
2425 #ifdef EXPENSIVE_CHECKS
24262426 MF.verify();
24272427 #endif
24282428 }
3030 const_iterator begin() const { return Vector.begin(); }
3131 const_iterator end() const { return Vector.end(); }
3232
33 #ifdef XDEBUG
33 #ifdef EXPENSIVE_CHECKS
3434 ~BlotMapVector() {
3535 assert(Vector.size() >= Map.size()); // May differ due to blotting.
3636 for (typename MapTy::const_iterator I = Map.begin(), E = Map.end(); I != E;
6161 RematerializationThreshold("spp-rematerialization-threshold", cl::Hidden,
6262 cl::init(6));
6363
64 #ifdef XDEBUG
64 #ifdef EXPENSIVE_CHECKS
6565 static bool ClobberNonLive = true;
6666 #else
6767 static bool ClobberNonLive = false;
804804 CachedUpwardsClobberingAccess.clear();
805805 }
806806
807 #ifdef XDEBUG
807 #ifdef EXPENSIVE_CHECKS
808808 // Run this only when expensive checks are enabled.
809809 verifyRemoved(MA);
810810 #endif