Skip to content

Commit f8d71b1

Browse files
committed
satcheck minisat2: make all solver hardness processing conditional
There is no need to run process_clause when its output wouldn't even be used.
1 parent a0dbf74 commit f8d71b1

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/solvers/sat/satcheck_minisat2.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,22 +140,24 @@ void satcheck_minisat2_baset<T>::lcnf(const bvt &bv)
140140

141141
solver->addClause_(c);
142142

143-
// To map clauses to lines of program code, track clause indices in the
144-
// dimacs cnf output. Dimacs output is generated after processing clauses
145-
// to remove duplicates and clauses that are trivially true. Here, a clause
146-
// is checked to see if it can be thus eliminated. If not, add the clause
147-
// index to list of clauses in solver_hardnesst::register_clause().
148-
static size_t cnf_clause_index = 0;
149-
bvt cnf;
150-
bool clause_removed = process_clause(bv, cnf);
151-
152-
if(!clause_removed)
153-
cnf_clause_index++;
154-
155143
with_solver_hardness(
156144
[&bv, &cnf, &clause_removed](solver_hardnesst &hardness) {
145+
// To map clauses to lines of program code, track clause indices in the
146+
// dimacs cnf output. Dimacs output is generated after processing
147+
// clauses to remove duplicates and clauses that are trivially true.
148+
// Here, a clause is checked to see if it can be thus eliminated. If
149+
// not, add the clause index to list of clauses in
150+
// solver_hardnesst::register_clause().
151+
static size_t cnf_clause_index = 0;
152+
bvt cnf;
153+
bool clause_removed = process_clause(bv, cnf);
154+
155+
if(!clause_removed)
156+
cnf_clause_index++;
157+
157158
hardness.register_clause(bv, cnf, cnf_clause_index, !clause_removed);
158159
});
160+
159161
clause_counter++;
160162
}
161163
catch(const Minisat::OutOfMemoryException &)

0 commit comments

Comments
 (0)