<div class="gmail_extra"><div class="gmail_quote">On Mon, Sep 10, 2012 at 1:18 AM, Duncan Sands <span dir="ltr"><<a href="mailto:baldrick@free.fr" target="_blank" class="cremed">baldrick@free.fr</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Hans,<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Just for perspective I had one other idea of how this type of transform<br>
might be implemented. I was talked out of it by someone, although I don't<br>
remember who, but I think it's still at least useful to think about.<br>
<br>
My idea had been to extend the IR to directly represent the concept of this<br>
operation. Currently, we have a 'br' instruction to represent binary control<br>
flow selection, and we have a 'switch' instruction to represent N-way<br>
control flow selection. We also have 'select' to represent binary value<br>
selection, but no instruction to represent N-way value selection. I<br>
suggested adding a new instruction 'selectswitch' (or some better name) to<br>
support selecting over N values based on an integer much the way switch<br>
works.<br>
</blockquote>
<br>
Would it be completely crazy to just extend the current select<br>
instruction? It already does N-way value selection, it's just that N<br>
is always 2.<br>
</blockquote>
<br></div>
alternatively, how about removing the select instruction from the IR<br>
altogether?  Maybe "select" really belongs in codegen only...<br></blockquote><div><br></div><div>I think it is extremely useful in the IR.</div><div><br></div><div>Without this type of formation, the number of basic blocks and control flow edges would be much higher. A lot of things that are currently one CFG edge of separation would become two or three. This would significantly complicate and slow down many optimization passes. Because we have an efficient model for representing select events in the SSA IR, I think it is very useful to have it in order to simplify the CFGs of the code and expedite analyses.</div>
</div></div>