Skip to content

Commit 6475c20

Browse files
committed
sca: faster phase change opt
1 parent 3b4d5c8 commit 6475c20

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

patronus-sca/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ patronus = { path = "../patronus" }
1414
baa = {version = "0.17.1", features = ["bigint"]}
1515
rustc-hash.workspace = true
1616
smallvec.workspace = true
17-
polysub = "0.2.2"
17+
polysub = "0.2.4"
1818
bit-set = "0.8.0"

patronus-sca/src/rewrite.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,13 @@ pub fn backwards_sub(
9292
let var = expr_to_var(e);
9393
if prev_uses == 1 && !input_vars.contains(&var) {
9494
todo.push_back((var, e));
95-
} else if !seen.contains(&e) {
96-
// try phase opt
95+
} else {
9796
let old_size = spec.size();
98-
spec.invert(var);
99-
if spec.size() > old_size {
97+
if spec.invert_size_change(var) < 0 {
10098
spec.invert(var);
101-
} else {
10299
println!("INVERTING {var} {old_size} -> {}", spec.size());
103100
}
104101
}
105-
seen.insert(e);
106102
});
107103
}
108104
}

0 commit comments

Comments
 (0)