Skip to content

Commit 9bfe815

Browse files
committed
Assume loop increments by one if increment cannot be found by heuristics
1 parent ae2d9d5 commit 9bfe815

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/util/loopUnrolling.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,11 @@ let fixedLoopSize loopStatement func =
264264
None
265265
else
266266
constBefore var loopStatement func >>= fun start ->
267-
assignmentDifference (loopBody loopStatement) var >>= fun diff ->
267+
let diff =
268+
match assignmentDifference (loopBody loopStatement) var with
269+
| Some d -> d
270+
| 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 *)
271+
in
268272
Logs.debug "comparison: ";
269273
Pretty.fprint stderr (dn_exp () comparison) ~width:max_int;
270274
Logs.debug "";

0 commit comments

Comments
 (0)