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

Duncan Sands baldrick at free.fr
Fri Jan 18 00:28:56 PST 2013


Hi Muhammad Tauqir,

On 17/01/13 17:22, Ahmad, Muhammad T wrote:
> Buzilla URL: http://llvm.org/bugs/show_bug.cgi?id=14664
>
> This patch adds the InstCombine that converts any expression of the form '(and (sub 0, (zext A to B)), C)' -->  'select A, C, 0' where type of A is i1.

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'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.  Anyway, if you do the sub -> sext optimization then the select
optimization becomes independent and can be discussed separately.

Ciao, Duncan.

>
> Please have a look (diff attached).
>
> Note: This is my first patch submission to this list and although I am trying to follow protocol as best as I can, if I am missing something, please let me know.
>
> - Muhammad Tauqir
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list