[PATCH] InstCombine: Optimize (1 << X) UPred CstP2 to X UPred Log2(CstP2)

David Majnemer david.majnemer at gmail.com
Sun Jun 9 05:10:29 PDT 2013


We may, after other optimizations, find ourselves with IR that looks like:

  %shl = shl i32 1, %y
  %cmp = icmp ult i32 %shl, 32

However, we should transform it to:

  %cmp = icmp ult i32 %y, 5

The attached patch teaches visitICmpInstWithInstAndIntCst how to perform
this transform.

-- 
David Majnemer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130609/e505c016/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shift-cmp.diff
Type: application/octet-stream
Size: 1620 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130609/e505c016/attachment.obj>


More information about the llvm-commits mailing list