[clang] [clang][dataflow] Move expensive solver asserts under EXPENSIVE_CHECKS (PR #205715)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 24 19:52:19 PDT 2026


https://github.com/zeyi2 created https://github.com/llvm/llvm-project/pull/205715

None

>From a6d9c63062e69ef63ca6793a0d8b4658ffaddcb4 Mon Sep 17 00:00:00 2001
From: Zeyi Xu <mitchell.xu2 at gmail.com>
Date: Thu, 25 Jun 2026 10:52:03 +0800
Subject: [PATCH] [clang][dataflow] Move expensive solver asserts under
 EXPENSIVE_CHECKS

---
 clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp b/clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp
index a39f0e0b29ad1..98109faff222a 100644
--- a/clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp
+++ b/clang/lib/Analysis/FlowSensitive/WatchedLiteralsSolver.cpp
@@ -162,9 +162,11 @@ class WatchedLiteralsSolverImpl {
       // FIXME: Consider replacing these with test cases that fail if the any
       // of the invariants is broken. That might not be easy due to the
       // transformations performed by `buildCNF`.
+#ifdef EXPENSIVE_CHECKS
       assert(activeVarsAreUnassigned());
       assert(activeVarsFormWatchedLiterals());
       assert(unassignedVarsFormingWatchedLiteralsAreActive());
+#endif
 
       const Variable ActiveVar = ActiveVars[I];
 



More information about the cfe-commits mailing list