There is a trunc(lshr (zext A), Cst) optimization in InstCombineCasts that
authorJakub Kuderski <jakub.kuderski@arm.com>
Tue, 8 Sep 2015 10:03:17 +0000 (10:03 +0000)
committerJakub Kuderski <jakub.kuderski@arm.com>
Tue, 8 Sep 2015 10:03:17 +0000 (10:03 +0000)
commitdf541601235ede978715cbdc24692e374a715442
tree5044e46f2f0d40509324ba4e55482a78ea699346
parent41517aa3f4e4d2212e6af71e7d97400fc137260c
There is a trunc(lshr (zext A), Cst) optimization in InstCombineCasts that
removes cast by performing the lshr on smaller types. However, currently there
is no trunc(lshr (sext A), Cst) variant.
This patch add such optimization by transforming trunc(lshr (sext A), Cst)
to ashr A, Cst.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@246997 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/InstCombine/InstCombineCasts.cpp
test/Transforms/InstCombine/cast.ll