Skip to content

Commit

Permalink
Assume loop increments by one if increment cannot be found by heuristics
Browse files Browse the repository at this point in the history
  • Loading branch information
karoliineh committed Jun 19, 2024
1 parent ae2d9d5 commit 9bfe815
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/util/loopUnrolling.ml
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,11 @@ let fixedLoopSize loopStatement func =
None
else
constBefore var loopStatement func >>= fun start ->
assignmentDifference (loopBody loopStatement) var >>= fun diff ->
let diff =
match assignmentDifference (loopBody loopStatement) var with
| Some d -> d
| None -> Z.one (* When we find a fixed loop and its start, but cannot detect the increment within the loop, we assume the increment is 1 *)
in
Logs.debug "comparison: ";
Pretty.fprint stderr (dn_exp () comparison) ~width:max_int;
Logs.debug "";
Expand Down

0 comments on commit 9bfe815

Please sign in to comment.