[DemandedBits] Add support for funnel shifts
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 26 Nov 2018 15:36:57 +0000 (15:36 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 26 Nov 2018 15:36:57 +0000 (15:36 +0000)
commitf94c8f0d1b96510b851009adf7f741b7313f4c8f
treeed168c92dcba5a9fc58f193b8eeacb3c4f6fafde
parenta21392bfc7e45073d4b6967f4daaf29011a2c64f
[DemandedBits] Add support for funnel shifts

Add support for funnel shifts to the DemandedBits analysis. The
demanded bits of the first two operands can be determined if the
shift amount is constant. The demanded bits of the third operand
(shift amount) can be determined if the bitwidth is a power of two.

This is basically the same functionality as implemented in D54869
and D54478, but for DemandedBits rather than InstCombine.

Differential Revision: https://reviews.llvm.org/D54876

llvm-svn: 347561
llvm/lib/Analysis/DemandedBits.cpp
llvm/test/Analysis/DemandedBits/intrinsics.ll