This patch implements optimization as mentioned in PR19753: Optimize comparisons...
authorSuyog Sarda <suyog.sarda@samsung.com>
Tue, 22 Jul 2014 19:19:36 +0000 (19:19 +0000)
committerSuyog Sarda <suyog.sarda@samsung.com>
Tue, 22 Jul 2014 19:19:36 +0000 (19:19 +0000)
commitc9ea25fc5106c41edb0614d8452d8d115bf421b3
tree5e798254991265fa2a02216a652cd42866218b67
parent3326ee444a8aa324c21e952204d7cf62916a9815
This patch implements optimization as mentioned in PR19753: Optimize comparisons with "ashr/lshr exact" of a constanst.
It handles the errors which were seen in PR19958 where wrong code was being emitted due to earlier patch.
Added code for lshr as well as non-exact right shifts.

It implements :
(icmp eq/ne (ashr/lshr const2, A), const1)" ->
(icmp eq/ne A, Log2(const2/const1)) ->
(icmp eq/ne A, Log2(const2) - Log2(const1))

Differential Revision: http://reviews.llvm.org/D4068

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@213678 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombine.h
lib/Transforms/InstCombine/InstCombineCompares.cpp
test/Transforms/InstCombine/icmp-shr.ll [new file with mode: 0644]