Skip to content

Scf for to repeat

ScfForToRepeat

Bases: RewriteRule


              flowchart TD
              bloqade.stim.rewrite.scf_for_to_repeat.ScfForToRepeat[ScfForToRepeat]

              

              click bloqade.stim.rewrite.scf_for_to_repeat.ScfForToRepeat href "" "bloqade.stim.rewrite.scf_for_to_repeat.ScfForToRepeat"
            

Rewrite scf.For to stim_cf.Repeat for REPEAT-eligible loops.

Eligibility: - Loop variable (first block arg) is unused - Iterable is a const range(N)

This should run as the last rewrite step, after all squin-to-stim conversions and cleanup. By this point the body is fully in stim dialect and block args are only artifacts of the scf.For structure.