Fix both the reaching definitions and liveness analysis not handling
nested loops correctly, resulting in compiler crashes or
miscompilation.
Details
Only iterating the outermost loop twice doesn't ensure that a fixpoint
is reached -- it necessary to process every loop 2 + N times, where N
is the nesting depth. The documentation of both analysis passes is
improved to better describe what they do and why they work like they
do.
Tests are added to ensure that nested loops are handled correctly.
Except for t03_ssa_loop_4, the previous implementation produced
incorrect code for the new tests.
Summary
Fix both the reaching definitions and liveness analysis not handling nested loops correctly, resulting in compiler crashes or miscompilation.
Details
Only iterating the outermost loop twice doesn't ensure that a fixpoint is reached -- it necessary to process every loop 2 + N times, where N is the nesting depth. The documentation of both analysis passes is improved to better describe what they do and why they work like they do.
Tests are added to ensure that nested loops are handled correctly. Except for
t03_ssa_loop_4
, the previous implementation produced incorrect code for the new tests.