]> granicus.if.org Git - llvm/commit
[APInt] Add isSubsetOf method that can check if one APInt is a subset of another...
authorCraig Topper <craig.topper@gmail.com>
Thu, 20 Apr 2017 16:17:13 +0000 (16:17 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 20 Apr 2017 16:17:13 +0000 (16:17 +0000)
commitb52e0e4247cfbcecc0b42dbd5bda8e0e8de6b5ea
tree94b0a83dc3c1cfae5a3c8d089a85c0f376ff9647
parent40c9368f4d7fe9f7a5c811cf7ae6d52218dca81a
[APInt] Add isSubsetOf method that can check if one APInt is a subset of another without creating temporary APInts

This question comes up in many places in SimplifyDemandedBits. This makes it easy to ask without allocating additional temporary APInts.

The BitVector class provides a similar functionality through its (IMHO badly named) test(const BitVector&) method. Though its output polarity is reversed.

I've provided one example use case in this patch. I plan to do more as a follow up.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300851 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/ADT/APInt.h
lib/Support/APInt.cpp
lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
unittests/ADT/APIntTest.cpp