Limit number of nonminimal_bool ops

This commit is contained in:
Alex Macleod 2024-08-03 12:02:02 +00:00
parent 834b691a9f
commit b2d0631300
2 changed files with 10 additions and 6 deletions

View File

@ -477,14 +477,12 @@ fn bool_expr(&self, e: &'tcx Expr<'_>) {
cx: self.cx, cx: self.cx,
}; };
if let Ok(expr) = h2q.run(e) { if let Ok(expr) = h2q.run(e) {
if h2q.terminals.len() > 8 { let stats = terminal_stats(&expr);
// QMC has exponentially slow behavior as the number of terminals increases if stats.ops > 7 {
// 8 is reasonable, it takes approximately 0.2 seconds. // QMC has exponentially slow behavior as the number of ops increases.
// See #825 // See #825, #13206
return; return;
} }
let stats = terminal_stats(&expr);
let mut simplified = expr.simplify(); let mut simplified = expr.simplify();
for simple in Bool::Not(Box::new(expr)).simplify() { for simple in Bool::Not(Box::new(expr)).simplify() {
match simple { match simple {

View File

@ -177,3 +177,9 @@ fn issue_12371(x: usize) -> bool {
// Should not warn! // Should not warn!
!x != 0 !x != 0
} }
// Not linted because it is slow to do so
// https://github.com/rust-lang/rust-clippy/issues/13206
fn many_ops(a: bool, b: bool, c: bool, d: bool, e: bool, f: bool) -> bool {
(a && c && f) || (!a && b && !d) || (!b && !c && !e) || (d && e && !f)
}