jasmin icon indicating copy to clipboard operation
jasmin copied to clipboard

Non-inlined for loops

Open eponier opened this issue 4 years ago • 1 comments
trafficstars

For loops whose bounds are not constant are not inlined. Consider, for instance:

export fn main (reg u64 io) -> reg u64 {
  inline int i;
  reg u64 res;
  for i = 0 to (int)io {
    res = i;
  }
  return res;
}

The problem is that some later passes assume that all for loops have been inlined. This program, for instance, is rejected with error:

Fatal error: exception File "src/liveness.ml", line 58, characters 14-20: Assertion failed

I think we should either support this kind of for loops or reject them directly during unrolling.

eponier avatar May 31 '21 15:05 eponier

I think it is hard to do it during unrolling (it is an iterative process). But we can add a check after unrolling.

bgregoir avatar May 31 '21 15:05 bgregoir