Skip to content

Inconsistent iterator optimization #75980

Open
@bugadani

Description

@bugadani

I'm not sure if this is the fault of const propagation (probably not?), but these examples (more examples, but a lot more messy) result in unexpected code.

In some instances, the function bodies are evaluated and are replaced by a constant value as expected. However, given some usage patterns, (the most simple is an extra iterator.next call where the return value is ignored) this simplification does not happen. It's not clear why some patterns can be simplified and others can't.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-const-evalArea: Constant evaluation, covers all const contexts (static, const fn, ...)A-mir-optArea: MIR optimizations

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions