Skip to content

Selection logic can miss optimisations due to non-simple subexpressions #3480

Open
@lpw25

Description

@lpw25

I was just writing a patch that generated cmm code and ran into an issue with the selection logic that I think is worth fixing at some point. Currently if you generate:

(+ (<< e 1) 1))

for some expression e then the shift and add will only be optimised if e is a "simple expression". This is due to the logic of emit_parts which doesn't really do the right thing. It should pull out all the "non-simple" parts of an expression so that what remains is a simple expression. Instead it checks that the expression is simple deeply and then either treats it all as simple or none of it as simple. More generally, this whole area seems like it could be made much more robust by separating out the simple expressions from the non-simple ones at the type level, and ensuring that all selection patterns operate only on simple expressions.

Activity

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

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