[llvm-commits] PATCH: instcombine switch on select of constants to br

Nick Lewycky nicholas at mxc.ca
Tue Mar 8 23:07:03 PST 2011


Cameron Zwarich wrote:
> On Feb 27, 2011, at 7:01 PM, Nick Lewycky wrote:
>
>> Frits van Bommel wrote:
>>> Since there has been no progress here for over six weeks, I updated
>>> this patch myself.
>>> Does anyone mind if I commit this version?
>>
>> I kinda wish it didn't work this way. Here's what I have in mind:
>>    1. fix llvm.org/PR774 (make the default case optional)
>>    2. one optimization which finds switches that have two destinations
>> and turns them into branches
>>    3. one optimization which sees select (and other things) feeding into
>> a switch and removes the impossible cases from the switch, possibly
>> including the default case.
>
> This sounds relevant to my interests... Have you estimated how much work it would take?

Not really, it would involve changing codegen which I just don't know 
anything about.

The IR changes don't look hard -- making the default dest optional means 
a largely mechanical update of the .bc format, Verifier, LangRef and 
friends -- there's only 28 call sites of getDefaultDest() to be audited 
for the fact it can return NULL -- plus we will also want to make sure 
that we never create zero-destination switches. It's on the order of two 
or three days ish? Then add time to update codegen, I guess.

Nick



More information about the llvm-commits mailing list