OSDN Git Service

[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)
commit6e9e89f4829bb33c73823cfa4c20d49581df1b1a
tree0c61e5a1f8ee50032f27065d9d90a692c17c2944
parent8b59b288436d52c60d94187251d6f89dde04f7dd
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@348549 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/DemandedBits.h
lib/Analysis/DemandedBits.cpp
lib/Transforms/Scalar/BDCE.cpp
test/Analysis/DemandedBits/vectors.ll [new file with mode: 0644]
test/Transforms/BDCE/vectors.ll