Skip to content

Commit 796123e

Browse files
committed
RequirementMachine: Avoid some expensive invariant checks in noassert builds
1 parent 2dd14af commit 796123e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/AST/RequirementMachine/HomotopyReduction.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -836,6 +836,7 @@ void RewriteSystem::verifyRewriteLoops() const {
836836
/// since this suggests a misunderstanding on my part.
837837
void RewriteSystem::verifyRedundantConformances(
838838
llvm::DenseSet<unsigned> redundantConformances) const {
839+
#ifndef NDEBUG
839840
for (unsigned ruleID : redundantConformances) {
840841
const auto &rule = getRule(ruleID);
841842
assert(!rule.isPermanent() &&
@@ -853,11 +854,13 @@ void RewriteSystem::verifyRedundantConformances(
853854
abort();
854855
}
855856
}
857+
#endif
856858
}
857859

858860
// Assert if homotopy reduction failed to eliminate a rewrite rule it was
859861
// supposed to delete.
860862
void RewriteSystem::verifyMinimizedRules() const {
863+
#ifndef NDEBUG
861864
for (const auto &rule : Rules) {
862865
// Note that sometimes permanent rules can be simplified, but they can never
863866
// be redundant.
@@ -895,4 +898,5 @@ void RewriteSystem::verifyMinimizedRules() const {
895898
abort();
896899
}
897900
}
901+
#endif
898902
}

0 commit comments

Comments
 (0)