On 12/9/2021 10:20 AM, Robin Dapp wrote:
Hi Jeff,
thanks for looking into this.
NP. I'd been watching this set evolve and I think it'll help our target
as well, so it seemed natural to handle the review :-)
What if the condition has a side effect? Doesn't this drop the side
effect by converting the conditional move into a simple move?
Hmm, good point, if the condition does more than a CC compare, it might
get tricky as we are not canonicalizing here (on purpose). Is there an
easy way out like checking something like side_effects_p ()?
I think if side_effects_p is true, we can just emit the conditional move
as-is without trying to collapse it to a simple move. It should be
exceedingly rare to have a side effect in the destination. Checking
side_effects_p will also reject if the destination is volatile MEM, but
that should be OK and also exceedingly rare.
Maybe we should drop this altogether and let the backend deal with it?
It would probably not know what to do and FAIL.
I like the idea of collapsing to a simple move if the true/false arms
are the same. Did you see that happen in practice? If so, I'd like
to keep it, but just guard with the !side_effects_p check.
jeff