[PATCH] D55297: [DemandedBits][BDCE] Support vectors of integers
Nikita Popov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 4 14:16:32 PST 2018
nikic created this revision.
nikic added a reviewer: spatel.
Herald added a subscriber: llvm-commits.
This came up during D54876 <https://reviews.llvm.org/D54876>. DemandedBits and BDCE currently only support scalar integers. This patch extends them to also handle vector integer operations. In this case the demanded bits are tracked for all lanes at once (as is done for known bits and demanded bits analyses in other places).
The implementation is mostly a matter of going from isIntegerTy to isIntOrIntVectorTy and switching some ConstantInt dyn_casts to use match instead.
I think the main notable change here from an API perspective is that the `getDemandedBits()` method now a) requires the instruction to have an int/vec-of-int type and b) returns a "scalar size in bits" value. Previously it allowed any sized instruction and returned a "type size in bits" value. In particular, for vectors this method would have previously returned a num elements * scalar size large value (of 1s). I checked existing uses of getDemandedBits() and from what I can determine none will be invoked on anything other than integer instructions. Only BDCE passed non-integer instructions to it sometimes, but that's also adjusted as part of this patch.
Repository:
rL LLVM
https://reviews.llvm.org/D55297
Files:
lib/Analysis/DemandedBits.cpp
lib/Transforms/Scalar/BDCE.cpp
test/Analysis/DemandedBits/vectors.ll
test/Transforms/BDCE/vectors.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55297.176710.patch
Type: text/x-patch
Size: 22449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181204/a554ca6d/attachment.bin>
More information about the llvm-commits
mailing list