[llvm-commits] [llvm] r163302 - in /llvm/trunk: lib/Transforms/Utils/SimplifyCFG.cpp test/Transforms/SimplifyCFG/switch_create.ll test/Transforms/SimplifyCFG/switch_to_lookup_table.ll
Duncan Sands
baldrick at free.fr
Mon Sep 10 01:18:36 PDT 2012
Hi Hans,
>> Just for perspective I had one other idea of how this type of transform
>> might be implemented. I was talked out of it by someone, although I don't
>> remember who, but I think it's still at least useful to think about.
>>
>> My idea had been to extend the IR to directly represent the concept of this
>> operation. Currently, we have a 'br' instruction to represent binary control
>> flow selection, and we have a 'switch' instruction to represent N-way
>> control flow selection. We also have 'select' to represent binary value
>> selection, but no instruction to represent N-way value selection. I
>> suggested adding a new instruction 'selectswitch' (or some better name) to
>> support selecting over N values based on an integer much the way switch
>> works.
>
> Would it be completely crazy to just extend the current select
> instruction? It already does N-way value selection, it's just that N
> is always 2.
alternatively, how about removing the select instruction from the IR
altogether? Maybe "select" really belongs in codegen only...
Ciao, Duncan.
More information about the llvm-commits
mailing list