[LLVMdev] Does LLVM optimize rudimentary i16 -> i32 conversions

Philip Reames listmail at philipreames.com
Mon Apr 20 15:57:05 PDT 2015


In general, yes.  Other passes may catch cases InstCombine doesn't. You 
may find some corner cases here and there.  Bug reports or patches are 
very welcome.  The largest area of potential concern is likely to be 
widdening/narrowing for induction variables in loops. I know we've hit 
one such issue recently.

I'm assuming you're compiling for a 32 bit or 64 bit architecture. If 
not, the answer might be extremely different.

Philip

On 04/17/2015 09:00 PM, Dave Pitsbawn wrote:
> In my language there are a lot of i16 definitions, but almost all of 
> the time they are upgraded to i32 because my add operations only 
> happen on i32.
>
> So to be representative to my language definition, I have a lots of 
> Sext/Zext and Truncs pretty much every time I add or subtract.
>
> As soon as I pass through InstCombine things look much nicer, all the 
> upcasts and downcasts go away, but my test cases are simple.
>
> Is InstCombine pretty good about finding most/all such cases?
>
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150420/beb493b9/attachment.html>


More information about the llvm-dev mailing list