This is an archive of the discontinued LLVM Phabricator instance.

[APInt] Add isSubsetOf method that can check if one APInt is a subset of another without creating temporary APInts
ClosedPublic

Authored by craig.topper on Apr 19 2017, 4:59 PM.

Details

Summary

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.

Diff Detail

Event Timeline

craig.topper created this revision.Apr 19 2017, 4:59 PM
spatel accepted this revision.Apr 20 2017, 6:56 AM

LGTM.

This revision is now accepted and ready to land.Apr 20 2017, 6:56 AM
davide accepted this revision.Apr 20 2017, 7:23 AM
This revision was automatically updated to reflect the committed changes.