From 39af0db425b756e9c641c5ec4e9ba03d964655e1 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Fri, 21 Apr 2017 19:16:52 +0000 Subject: [PATCH] [InstCombine] use isSubsetOf() for efficiency C | ~D == -1 ~(C | ~D) == 0 ~C & D == 0 D & ~C == 0 D.isSubsetOf(C) git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@301021 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp b/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp index d7e709c9cca..10faf478676 100644 --- a/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp +++ b/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp @@ -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; -- 2.40.0