[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)
commita8129a11222249d5072c132927dbf9d402b5f9da
tree5a449591a98fa76421c1dd0297c2a5a074f94091
parentb7701bc9af13662f9658cf6a9db50daad3affd90
[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

llvm-svn: 300851
llvm/include/llvm/ADT/APInt.h
llvm/lib/Support/APInt.cpp
llvm/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp
llvm/unittests/ADT/APIntTest.cpp