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

Ahmad, Muhammad T muhammad.t.ahmad at intel.com
Fri Jan 18 15:09:10 PST 2013


Thanks Duncan for the feedback.

Please find the updated diff.
Instructions of form '(sub 0 (zext(bool)))' --> 'sext(bool)' now.

I guess a separate discussion would then address '(and (sext(bool)), X)' --> '(select bool, X, 0)'?

Thanks.
- Muhammad Tauqir

-----Original Message-----
From: llvm-commits-bounces at cs.uiuc.edu [mailto:llvm-commits-bounces at cs.uiuc.edu] On Behalf Of Duncan Sands
Sent: Friday, January 18, 2013 3:29 AM
To: llvm-commits at cs.uiuc.edu
Subject: Re: [llvm-commits] [PATCH] Bug 14664: InstCombine missing canonicalization of sub-and into a select

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
>

_______________________________________________
llvm-commits mailing list
llvm-commits at cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
-------------- next part --------------
A non-text attachment was scrubbed...
Name: zext_sub_to_sext.diff
Type: text/x-patch
Size: 1982 bytes
Desc: zext_sub_to_sext.diff
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130118/93909c35/attachment.bin>


More information about the llvm-commits mailing list