Skip to content

IRStructurizer: Support native Julia for loop syntax #2

@maleadt

Description

@maleadt

Julia's native for k in start:stop syntax generates IR that the structurizer does not recognize.

Current workaround: Use explicit while-loop counting, which the structurizer upgrades to ForOp:

# Instead of:
for k in 1:stride:limit
    # ...
end

# Use:
k = 1
while k < limit
    # ...
    k += stride
end

Fixing this is hard because the Julia iterator protocol generates a lot of code that isn't easy to pattern match, especially after optimization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions