Closed captbaritone closed 2 years ago
When in a loop of any kind, we need to disallow propagating constants to any variable that gets updated anywhere in the loop. Currently we only prevent propagation to variable access for variables that get touched before the access.
Here's an example of code that fails:
n = 0; loop(10, g = n; n += 1);
https://eel.capt.dev/?optimize=MQ%3D%3D&globals=eyJ4IjowfQ%3D%3D&eel=biA9IDA7IGxvb3AoMTAsIGcgPSBuOyBuICs9IDEpOw%3D%3D
I think optimizations are not going to be necessary.
When in a loop of any kind, we need to disallow propagating constants to any variable that gets updated anywhere in the loop. Currently we only prevent propagation to variable access for variables that get touched before the access.