opt niche known-zero loop

This commit is contained in:
phyto 2023-06-01 11:28:18 +00:00
parent 6d18d0b0b3
commit c50318a67a
Signed by: phyto
SSH Key Fingerprint: SHA256:FJdIUDW+Q/c/oLlaNI7vrxCrv0VMxMgT6usJ+7A/wo0
1 changed files with 6 additions and 1 deletions

View File

@ -89,7 +89,12 @@ fn purge_comments(ops: &mut [Op]) -> bool {
for i in 0..ops.len() - 1 {
use Op::*;
if let [Set(0), LoopStart(x)] = ops[i..i + 2] {
dbg!(i);
for j in i + 1..=x {
ops[j] = Nop;
acted = true;
}
}
if let [LoopEnd(..), LoopStart(x)] = ops[i..i + 2] {
for j in i + 1..=x {
ops[j] = Nop;
acted = true;