[DemandedBits][BDCE] Support vectors of integers
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 6 Dec 2018 23:50:32 +0000 (23:50 +0000)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 6 Dec 2018 23:50:32 +0000 (23:50 +0000)
commitcf65b9207b58e09e9a763ff4f1aed8687c086f37
treefb4f1ad71d2375dcd7e2116a7c298af4e32404b4
parentd7b6b62debd6508d40070a0a3b216f39cd7f6b5f
[DemandedBits][BDCE] Support vectors of integers

DemandedBits and BDCE currently only support scalar integers. This
patch extends them to also handle vector integer operations. In this
case bits are not tracked for individual vector elements, instead a
bit is demanded if it is demanded for any of the elements. This matches
the behavior of computeKnownBits in ValueTracking and
SimplifyDemandedBits in InstCombine.

The getDemandedBits() method can now only be called on instructions that
have integer or vector of integer type. Previously it could be called on
any sized instruction (even if it was not particularly useful). The size
of the return value is now always the scalar size in bits (while
previously it was the type size in bits).

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

llvm-svn: 348549
llvm/include/llvm/Analysis/DemandedBits.h
llvm/lib/Analysis/DemandedBits.cpp
llvm/lib/Transforms/Scalar/BDCE.cpp
llvm/test/Analysis/DemandedBits/vectors.ll [new file with mode: 0644]
llvm/test/Transforms/BDCE/vectors.ll