Skip to content

Commit d3e8681

Browse files
committed
Loop unrolling should generate the loop body n times, not duplicate it
This prevents probems with redeclared variables in the SV output.
1 parent 4832414 commit d3e8681

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/jib_compile.ml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,14 +1074,14 @@ module Make (C : CONFIG) = struct
10741074
[idecl l (CT_fint 64) gs; iblock (setup @ [call (CL_id (gs, CT_fint 64))] @ cleanup)]
10751075
in
10761076

1077+
10771078
let loop_start_label = label "for_start_" in
10781079
let loop_end_label = label "for_end_" in
1079-
let body_setup, body_call, body_cleanup = compile_aexp ctx body in
10801080
let body_gs = ngensym () in
1081-
10821081
let loop_var = name loop_var in
10831082

10841083
let loop_body prefix continue =
1084+
let body_setup, body_call, body_cleanup = compile_aexp ctx body in
10851085
prefix
10861086
@ [
10871087
iblock

0 commit comments

Comments
 (0)