[PATCH] Optimize icmp involving addition better

Saleem Abdulrasool compnerd at compnerd.org
Tue Apr 9 22:56:28 PDT 2013


On Tue, Apr 9, 2013 at 9:12 PM, David Majnemer <david.majnemer at gmail.com>wrote:

> Hello,
>
> The attached patch allows LLVM to optimize sequences like the
>
> %add = add nsw i32 %x, 1
> %cmp = icmp sgt i32 %add, %y
>
> into:
>
> %cmp = icmp sge i32 %x, %y
>
> as well as:
>
> %add1 = add nsw i32 %x, 20
> %add2 = add nsw i32 %y, 57
> %cmp = icmp sge i32 %add1, %add2
>
> into:
>
> %add = add nsw i32 %y, 37
> %cmp = icmp sle i32 %cmp, %x
>
> Patches are attached and apply cleanly on r179146
>

LGTM.

I am not sure if there is a general owner for InstCombine that should have
a look over this as well though.


> Thanks,
> David Majnemer
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>


-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130409/f414dd9a/attachment.html>


More information about the llvm-commits mailing list