[llvm-commits] [PATCH] Bug 14664: InstCombine missing canonicalization of sub-and into a select

Nadav Rotem nrotem at apple.com
Fri Jan 18 16:21:16 PST 2013


On Jan 18, 2013, at 12:28 AM, Duncan Sands <baldrick at free.fr> wrote:

> how about converting "sub 0, zext A to B" into "sext A to B" instead?  There are
> a bunch of existing optimizations which deal with expressions like
> "and (sext A to B), C",and they would then kick in.

I think that it is a good idea. 

>  I'm not sure that they
> would produce a select, in fact it's not clear to me that a select is the best
> choice here.  

I think that Select is a better canonicalization.

> Anyway, if you do the sub -> sext optimization then the select
> optimization becomes independent and can be discussed separately.
> 

I agree. Muhammad, can you implement this as two optimizations ?

Also, it's worth looking at the "match" API that instcombine uses. It usually makes the code cleaner. 

Thanks,
Nadav

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130118/ff7ede62/attachment.html>


More information about the llvm-commits mailing list