Skip to content

Conversation

@Mittagskogel
Copy link

This PR introduces a new AST desugaring transformation unroll_loops().

The transformation unrolls loops with constant loop bounds, giving _track_local_consts() more room to propagate values and prune temporary variables. This transformation is disabled by default, but can be enabled via the unroll_loops: int command line argument to the create_preprocessed_ast tool. Passing a positive non-zero integer n to the argument enables unrolling loops with at most n iterations. Passing a negative number disables the check and unrolls all loops with constant bounds. Passing zero (default) disables the transformation.

Only loops with integer literal bounds are transformed. Additionally, loops containing (nested) CYCLE or EXIT statements are ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant