diff --git a/lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp b/lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp index 34fbdd4a3..31b374c68 100644 --- a/lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp +++ b/lib/Decompiler/DLACollapseIdentityAndInheritanceCC.cpp @@ -99,7 +99,8 @@ bool CollapseIdentityAndInheritanceCC::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("after-collapse-equality.dot"); - revng_assert(TS.verifyNoEquality()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyNoEquality()); revng_log(LogVerbose, "#### Merging Inheritance SCC: ... "); bool CollapsedInheritance = collapseInheritanceSCC(TS); @@ -108,13 +109,15 @@ bool CollapseIdentityAndInheritanceCC::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("after-collapse-inheritance.dot"); - revng_assert(TS.verifyInheritanceDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyInheritanceDAG()); // The following assertion is not really necessary. // In principle all the rest of the pipeline should work fine without it, but // I think that if it's triggered something might be wrong in how we emit // instance edges earlier. If it's ever triggered, please double check. - revng_assert(TS.verifyInstanceDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyInstanceDAG()); revng_log(LogVerbose, "#### Merging Mixed SCC: ... "); bool Removed = false; @@ -124,7 +127,8 @@ bool CollapseIdentityAndInheritanceCC::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("after-collapse.dot"); - revng_assert(TS.verifyDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG()); return CollapsedEqual or CollapsedInheritance or Removed; } diff --git a/lib/Decompiler/DLAComputeUpperMemberAccess.cpp b/lib/Decompiler/DLAComputeUpperMemberAccess.cpp index 986cfd667..d127074bb 100644 --- a/lib/Decompiler/DLAComputeUpperMemberAccess.cpp +++ b/lib/Decompiler/DLAComputeUpperMemberAccess.cpp @@ -23,7 +23,8 @@ static Logger<> Log("dla-compute-upper-member-access"); namespace dla { bool ComputeUpperMemberAccesses::runOnTypeSystem(LayoutTypeSystem &TS) { - revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree()); bool Changed = false; using LTSN = LayoutTypeSystemNode; diff --git a/lib/Decompiler/DLACreateInterProceduralTypes.cpp b/lib/Decompiler/DLACreateInterProceduralTypes.cpp index e67cc530a..89c4a7a3d 100644 --- a/lib/Decompiler/DLACreateInterProceduralTypes.cpp +++ b/lib/Decompiler/DLACreateInterProceduralTypes.cpp @@ -7,6 +7,7 @@ #include "llvm/IR/Instructions.h" #include "llvm/IR/Module.h" +#include "revng/Support/Debug.h" #include "revng/Support/IRHelpers.h" #include "DLAStep.h" @@ -99,6 +100,7 @@ bool StepT::runOnTypeSystem(LayoutTypeSystem &TS) { } } } - revng_assert(TS.verifyConsistency()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyConsistency()); return TS.getNumLayouts() != 0; } diff --git a/lib/Decompiler/DLACreateIntraProceduralTypes.cpp b/lib/Decompiler/DLACreateIntraProceduralTypes.cpp index 6ceb8053a..b02386ff8 100644 --- a/lib/Decompiler/DLACreateIntraProceduralTypes.cpp +++ b/lib/Decompiler/DLACreateIntraProceduralTypes.cpp @@ -18,6 +18,7 @@ #include "llvm/IR/Module.h" #include "llvm/Pass.h" +#include "revng/Support/Debug.h" #include "revng/Support/IRHelpers.h" #include "DLAHelpers.h" @@ -844,7 +845,9 @@ bool StepT::runOnTypeSystem(LayoutTypeSystem &TS) { } } } - revng_assert(TS.verifyConsistency()); - revng_assert(TS.verifyInstanceDAG()); + if (VerifyLog.isEnabled()) { + revng_assert(TS.verifyConsistency()); + revng_assert(TS.verifyInstanceDAG()); + } return Changed; } diff --git a/lib/Decompiler/DLAHelpers.cpp b/lib/Decompiler/DLAHelpers.cpp index 428bf4da6..c371d8fe5 100644 --- a/lib/Decompiler/DLAHelpers.cpp +++ b/lib/Decompiler/DLAHelpers.cpp @@ -140,7 +140,8 @@ using MixedGT = llvm::GraphTraits; bool removeInstanceBackedgesFromInheritanceLoops(LayoutTypeSystem &TS) { bool Changed = false; - revng_assert(TS.verifyInheritanceDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyInheritanceDAG()); if (Log.isEnabled()) TS.dumpDotOnFile("before-remove-instance-inheritance-loops.dot"); diff --git a/lib/Decompiler/DLAMakeInheritanceTree.cpp b/lib/Decompiler/DLAMakeInheritanceTree.cpp index 058bd8fa0..40363c0b6 100644 --- a/lib/Decompiler/DLAMakeInheritanceTree.cpp +++ b/lib/Decompiler/DLAMakeInheritanceTree.cpp @@ -48,7 +48,8 @@ using CollapseSetIterCmp = std::integral_constant; bool MakeInheritanceTree::runOnTypeSystem(LayoutTypeSystem &TS) { bool Changed = false; - revng_assert(TS.verifyDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG()); if (Log.isEnabled()) TS.dumpDotOnFile("before-make-inheritance-tree.dot"); @@ -150,8 +151,10 @@ bool MakeInheritanceTree::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("after-make-inheritance-tree.dot"); - revng_assert(TS.verifyInheritanceTree()); - revng_assert(TS.verifyInheritanceDAG()); + if (VerifyLog.isEnabled()) { + revng_assert(TS.verifyInheritanceTree()); + revng_assert(TS.verifyInheritanceDAG()); + } if (Changed) { // Whenever we collapse nodes, we might end up creating loops of inheritance @@ -161,8 +164,10 @@ bool MakeInheritanceTree::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("after-final-inheritance-tree.dot"); - revng_assert(TS.verifyInheritanceTree()); - revng_assert(TS.verifyDAG()); + if (VerifyLog.isEnabled()) { + revng_assert(TS.verifyInheritanceTree()); + revng_assert(TS.verifyDAG()); + } return Changed; } diff --git a/lib/Decompiler/DLAMakeLayouts.cpp b/lib/Decompiler/DLAMakeLayouts.cpp index da4743ae9..28b5ae6fe 100644 --- a/lib/Decompiler/DLAMakeLayouts.cpp +++ b/lib/Decompiler/DLAMakeLayouts.cpp @@ -648,7 +648,8 @@ static Layout *makeLayout(const LayoutTypeSystem &TS, } static bool makeLayouts(const LayoutTypeSystem &TS) { - revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree()); std::map LayoutCTypes; LayoutSet Layouts; diff --git a/lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp b/lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp index 56a84b440..d70324002 100644 --- a/lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp +++ b/lib/Decompiler/DLAPruneLayoutNodesWithoutLayout.cpp @@ -24,7 +24,8 @@ bool PruneLayoutNodesWithoutLayout::runOnTypeSystem(LayoutTypeSystem &TS) { using LTSN = LayoutTypeSystemNode; if (Log.isEnabled()) TS.dumpDotOnFile("before-prune.dot"); - revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree()); std::set Visited; std::set ToRemove; @@ -67,8 +68,9 @@ bool PruneLayoutNodesWithoutLayout::runOnTypeSystem(LayoutTypeSystem &TS) { TS.removeNode(N); } - revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree() - and TS.verifyLeafs()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG() and TS.verifyInheritanceTree() + and TS.verifyLeafs()); if (Log.isEnabled()) TS.dumpDotOnFile("after-prune.dot"); return Changed; diff --git a/lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp b/lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp index 42f46075b..26d79d50c 100644 --- a/lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp +++ b/lib/Decompiler/DLARemoveTransitiveInheritanceEdges.cpp @@ -98,7 +98,8 @@ bool RemoveTransitiveInheritanceEdges::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("before-remove-transitive-edges.dot"); - revng_assert(TS.verifyDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG()); bool Changed = false; for (LTSN *Root : llvm::nodes(&TS)) { @@ -196,7 +197,8 @@ bool RemoveTransitiveInheritanceEdges::runOnTypeSystem(LayoutTypeSystem &TS) { if (Log.isEnabled()) TS.dumpDotOnFile("after-remove-transitive-edges.dot"); - revng_assert(TS.verifyDAG()); + if (VerifyLog.isEnabled()) + revng_assert(TS.verifyDAG()); return Changed; } // namespace dla diff --git a/lib/Decompiler/DLATypeSystem.cpp b/lib/Decompiler/DLATypeSystem.cpp index 44cce5312..fbaab8473 100644 --- a/lib/Decompiler/DLATypeSystem.cpp +++ b/lib/Decompiler/DLATypeSystem.cpp @@ -498,7 +498,7 @@ void LayoutTypeSystem::removeNode(LayoutTypeSystemNode *N) { Layouts.erase(LayoutIt); } -static Logger<> VerifyDLALog("dla-verify"); +static Logger<> VerifyDLALog("dla-verify-strict"); bool LayoutTypeSystem::verifyConsistency() const { for (auto &NodeUPtr : Layouts) {