Description
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