[PATCH] [llgo] irgen: generate switch instructions

Andrew Wilkins axwalk at gmail.com
Thu Jan 8 18:38:19 PST 2015


On Fri Jan 09 2015 at 02:36:39 Philip Reames <listmail at philipreames.com>
wrote:

>
> On 01/08/2015 01:15 AM, Chandler Carruth wrote:
>
>
> On Wed, Jan 7, 2015 at 11:05 AM, Peter Collingbourne <peter at pcc.me.uk>
> wrote:
>
>> > I don't know if this will ever be necessary, but another option is for
>> llgo to grow its own IR on top of go/ssa. I'd rather not go there for this,
>> though.
>>
>>
>> Agreed. FWIW, the long term direction I'd like to see is attempting to
>> extend go/ssa with what we need (in this particular case, a native switch
>> instruction).
>>
>> > I did look to see if there was an existing pass, but again I couldn't
>> see anything that looked relevant
>>
>>
>> If you grep for `SimplifyCFGOpt::FoldValueComparisonIntoPredecessors` you
>> should find something.
>>
>> > Geo-mean improvement of 0.49% (0.23% - 0.75% @ 95% CI)
>>
>>
>> Great! I'm a little surprised that we can do better than LLVM on its own,
>> but maybe I don't understand what the simplifycfg code is doing.
>
>
> Just a peanut gallery comment, but I'm pretty disappointed that LLVM can't
> turn if-chains into switches for you. I think not dealing with switches
> sounds like a really reasonable simplification for a frontend to desire.
> The optimizer should fix this code, and should both be faster and more
> powerful in doing so.
>
> I agree here.
>
>
>  Any interest in trying to make LLVM's switch formation powerful enough
> to catch the cases you care about? Or at least reducing the test case we
> missed? If we can do that, it seems like it would remove the ugliness from
> the approach by letting you generate "naive" switches with high confidence
> that they optimize appropriately?
>
> This is close enough to my own interests that if you can create a small
> test case, I'll take a serious look at fixing it.  I'm not going to go too
> far, but if it ends up being a simple fix, I'd like to have this work.
> Please file a bug with your IR fragment.
>

http://llvm.org/bugs/show_bug.cgi?id=22168

Cheers,
Andrew
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150109/4aa708a2/attachment.html>


More information about the llvm-commits mailing list