jasmin
jasmin copied to clipboard
Non-inlined for loops
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.
I think it is hard to do it during unrolling (it is an iterative process). But we can add a check after unrolling.