[InstCombine] use isSubsetOf() for efficiency

C | ~D == -1
~(C | ~D) == 0
~C & D == 0
D & ~C == 0
D.isSubsetOf(C)

llvm-svn: 301021
This commit is contained in:
Sanjay Patel 2017-04-21 19:16:52 +00:00
parent ab6b47d2e7
commit 0f001a4701
1 changed files with 1 additions and 1 deletions

View File

@ -282,7 +282,7 @@ Value *InstCombiner::SimplifyDemandedUseBits(Value *V, APInt DemandedMask,
// combining, SCEV, and codegen.
const APInt *C;
if (match(I->getOperand(1), m_APInt(C)) && !C->isAllOnesValue()) {
if ((*C | ~DemandedMask).isAllOnesValue()) {
if (DemandedMask.isSubsetOf(*C)) {
// Force bits to 1 to create a 'not' op.
I->setOperand(1, ConstantInt::getAllOnesValue(VTy));
return I;